Search Unity

Visual Studio and C# scripts no longer opening!

Discussion in 'Editor & General Support' started by Stephan-B, Oct 20, 2011.

  1. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Hi!

    For some reason and all of a sudden, my C# scripts inside my project won't open in Visual Studio 2010 anymore. Instead they open in MonoDevelop.

    Visual Studio is still selected as my editor. When I double click or try to open a script, I see a message about Visual Studio opening but then instead the script shows up in MonoDevelop.

    What gives and how do I fix this?
     
    Last edited: Oct 25, 2011
  2. CriTaG

    CriTaG

    Joined:
    Oct 4, 2011
    Posts:
    8
    I have the same problem sometimes. The preferences are set on VS.

    When I restart Unity, the problem is solved, most of the times.
    Let's hope that this problem is fixed in the new Unity :).
     
  3. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Does anyone have any solutions for this?
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,241
    Got the same issue now. It doesn't solve by restarting Unity and neither by resetting the file associations in VS.
    I got 2 editions of VS installed:
    The Express VS 10 starts if I select it. I don't know if Unity found it itself.
    Unity didn't know about the pro version so I used the Preferences -> Browse option to select the specific VS exe to start. It starts MD instead.

    For some reason, this now works again. I installed a plugin to VS and switched between all options and at some point Unity opened the right VS again. No idea what happened.
     
    Last edited: Oct 27, 2011
  5. CriTaG

    CriTaG

    Joined:
    Oct 4, 2011
    Posts:
    8
    What you can do, is work the other way:
    Start your VC.
    Go to: File --> Open --> Project/Solution
    select the csharp solution from your Unity project.

    Keep VC running. If you create a new script, your VC will ask for a reload, but you can always program within the program.
    This is the way I work now and I like it.
     
  6. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    105
    i know this thread is somewhat dated but i post anyway, because i found a solution or better said the reason of such strange behavior

    OS: Win 7 Ultimate

    it fixed for me when i turned Visual studio back to NOT start as Administrator wich i turned on before for some reason

    in short: it looks like Unity 3d behaves somewhat strange if the external editor is started as Administrator i am not sure what is the deeper reason of that behave, i could think of this: unity 3d isnt started as Administrator so it cant start another programm that should be started as Administrator.

    how ever: make sure Visual Studio is NOT started in Administrator mode should fix it!

    have a nice day....
     
    A_Vrankie likes this.
  7. EttiboPlop

    EttiboPlop

    Joined:
    Jan 22, 2014
    Posts:
    1
    Hi guys,
    I have found a solution to be able to kind of work this problem out.
    It seems there is a problem with the opening of visual studio and the sln file.
    So all you have to do is open the file yourProject-csharp.sln not yourProjet.sln (those 2 files are automatically generated by unity) and then you can have all your interactions back between Unity and Vs.
    Hope this can help you out
     
  8. A_Vrankie

    A_Vrankie

    Joined:
    Jun 14, 2017
    Posts:
    2
    Changing the "start with administrative privilege" option woked for me, thx

    however; instead of opening both without admin, I open both WITH admin. It seems installing a new version of unity resets this setting (makes a new shortcut without it).
     
  9. adretixgaming

    adretixgaming

    Joined:
    Jun 13, 2019
    Posts:
    1
    i just downloaded unity and tried to open a c# project but it never opened and they told me to check external appliction preferences
     
    Halilkunge likes this.
  10. dev-borisov-alexey

    dev-borisov-alexey

    Joined:
    Oct 6, 2013
    Posts:
    1
    Hi guys,
    I removed *.sln file and restart Unity. The problem is solved.
     
  11. jipsen

    jipsen

    Joined:
    May 22, 2018
    Posts:
    6
    That didn't work for me... scripts still won't open.
     
  12. Kosta99DT

    Kosta99DT

    Joined:
    Mar 31, 2017
    Posts:
    5
    I have same problem
     
  13. UncleBanana

    UncleBanana

    Joined:
    Sep 14, 2018
    Posts:
    1
    I had the same problem with Visual Studio Code and none of the solutions above helped me. I uninstalled Visual Studio Code and then reinstalled it, but this time using the system installer rather than the user installer.
    I think it might have been an update to Visual Studio Code that broke it.

    Answer: Reinstall Visual Studio Code
     
  14. MadhuJO2

    MadhuJO2

    Joined:
    Apr 5, 2018
    Posts:
    1
    Simply delete
    .vs folder
    .vscode folder
    and
    all 3 assembly files
    including .sln and restart unity everything becomes normal
     
  15. TheNenet

    TheNenet

    Joined:
    Nov 4, 2017
    Posts:
    4

    Where do you find theses folders?
     
  16. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,241
    In your project. They may be hidden by the system, so in some cases, you may have to show hidden files/folders.