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

    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

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

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    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:
    187
    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....
     
    Al-Masry and A_Vrankie like 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:
    37
    That didn't work for me... scripts still won't open.
     
  12. V_endeta

    V_endeta

    Joined:
    Mar 31, 2017
    Posts:
    28
    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:
    5

    Where do you find theses folders?
     
    samisuleman1 likes this.
  16. tobiass

    tobiass

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

    krotovar

    Joined:
    Jun 25, 2019
    Posts:
    3
    Unity 2019 - 2020 So/ I had a problem with Unity hub - new Unity versions isn't intaling at all (Incomplete or corrupted file)
    and as bonus in Unity my Visual studio doesnt have proper intellisense
    If you have simple only last problem :
    1. preference - external tool - script editor - Visual studio
    But in this case my Unity stop to open scripts.
    Than I found onlyone total solution:
    1. delete Unity
    2 Instal Unity hub
    3. Instal Visual Studio from microsoft separeted
    4. Download torrent (dont't forget to turn off Mac version) from arhive on unity site https://unity3d.com/ru/get-unity/download/archive
    5. Instal Unity and all modules separeted! Not from Unity hub! Only by hands as true old-school
    6. Locate from hub installed Unity version
    Done! You are awesome! everything work!
    Hope it will help? becose I didn't found any solution online for those kind of problem
     
  18. bdspvl

    bdspvl

    Joined:
    Jul 15, 2017
    Posts:
    5
    Hello all.. Unity and VS2019 was working ok till a day ago. Unity coding no longer opens in VS2019 C#. So now I'm reinstalling VS2019 AND Unity to see if this will fix this...
     
  19. bdspvl

    bdspvl

    Joined:
    Jul 15, 2017
    Posts:
    5
    Also was working on Unity High Speed Chase training when the crash happen and it no longer opened code in VS from Unity. What I was doing up to that point was do a step and save it as a VS program with basically the same title description shortened. Was working well up to then.
     
  20. Fireseadog6

    Fireseadog6

    Joined:
    Feb 7, 2021
    Posts:
    1
    same here, there seems to be no clear solution and no yt totorial. :(
     
  21. Asko1963

    Asko1963

    Joined:
    Sep 19, 2020
    Posts:
    1
    Hi
    I don't know if this generates more problems later but I changed Unity External Tools External Script Editor setting from "Visual Studio" to "Open by file extension" and that works fine for me.

    upload_2021-2-15_20-48-2.png
     
    wethings likes this.
  22. Necrophyte

    Necrophyte

    Joined:
    Aug 22, 2017
    Posts:
    1
    https://docs.microsoft.com/en-us/vi...-visual-studio-tools-for-unity?pivots=windows

    This was the fix for me. For anyone who came here where External Script editor was showing just open by extension and Browse.

    Summary..
    Click Browse and go to the visual studio install. For me this was C:\Program Files(x86)\Microsoft Visual Studio\2019/Community\Common 7\IDE
    Then select the devenv.exe file.
    Once I did this it started thinking, and then populated my dropdown with Visual 2019 and Visual 2019 community. I chose community.
    From there on every thing went fine.