Search Issue Tracker

Fixed in 4.5.3

Votes

167

Found in

4.3.0f4

Issue ID

568656

Regression

Yes

Double clicking a C# script will open MonoDevelop instead of Visual Studio

CodeEditors

-

Repro steps:
1. Set Visual Studio as your external code editor in Preferences and double click on a C# script.
2. A popup box saying "Starting Visual Studio" shows up, but then it disappears and MonoDevelop opens instead.

Update 2014-06-12 please go for this URL or a discussion of the fix for this bug in 4.5.1p1 and beyond: http://forum.unity3d.com/threads/double-clicking-a-c-script-should-open-visual-studio.251358/

Update 2014-08-01 A few remaining fixes for these Visual Studio launching problems have landed and will be available in 4.5.3p1. These fixes include:

* Additional retries when a new Visual Studio session is busy while Unity attempts to open a solution file or script file.
* New logging of information about the Visual Studio detection and launching process to the editor log.

Comments (64)

  1. 1252c55d92c667d3aaceb2eb8ffe89fe?d=mm

    ArnoStalgik

    Aug 16, 2015 10:35

    Hi all,

    Just to say I am on 5.1.2 and the issue still exists.

    My windows was just reinstalled (win10 with VS 2015 community edition and SQL Express). Each time I click on a script file, it opens VS2010 PowerShell with errors

    I have associed CS files with VS 2015 but nothing changes and of course, I gave Unity the full path to the devenv.exe but no way.

    Please help, I would really like use VS

  2. 1f1f92c31a1ef40fd13a74dfde4510f3?d=mm

    seansteezy

    Dec 15, 2014 19:40

    Hey @JOSHPETERSON, I'm experiencing the same issue, with Unity 4.6.0f3. Will those 4.5 fixes help? I just noticed it happening when I imported the asset store tools for a project I was working on. Never had that issue before. Do you think they're related?

    Also, please advise on any info I can give to help find the cause of this bug.

    Thanks!

    -ss

  3. 8300b3270eefea234f68d0bf27418e2a?d=mm

    mhardy

    Sep 18, 2014 14:13

    Note: if I open the -csharp.sln file in VS13 /first/, double clicking a file in Unity correctly goes to the open project. It's only the first double click if VS13 isn't open with the sln that it goes awry.

  4. 8300b3270eefea234f68d0bf27418e2a?d=mm

    mhardy

    Sep 18, 2014 14:07

    still a problem in 4.6.0b18

    Opens VS2010 (which is just a Shell install so is worthless), but refuses to open in VS2013 (even if it's already started - which previously would allow Unity to find it).

    Editor.log only makes one mention of VS:

    "retrying grabbing VisualStudios mainwindow."

  5. Bf3108ae49d6511ccc57a456c94090b6?d=mm

    orshee

    Sep 15, 2014 14:07

    same thing happens in 4.6b17

  6. 8b1a42e8bcbf816696f60a10cfa3b940?d=mm

    JoshPeterson

    Sep 02, 2014 13:01

    @PLENG: If you are using 4.5.3p1 or later, can you submit a bug after this problem occurs? I would like to see the information added to the Editor.log file in that release. It may help us find the cause of the problem in this case.

  7. 08590141cf2f32d4c3bf55ebe5b750e5?d=mm

    Pleng

    Aug 30, 2014 04:30

    This issue is NOT resolved. Still happens for me.

    If I do the rename trick, then Visual Studio opens without solution or cs file loaded, and then the cs file is opened in notepad!

  8. 8b1a42e8bcbf816696f60a10cfa3b940?d=mm

    JoshPeterson

    Aug 18, 2014 14:47

    Since 4.5.3p1 is now available with the latest corrections for this issue, I'm interested to hear about any problems that are still occurring. Specifically, the Editor.log file should have more details about the process of finding and using the correct version of Visual Studio now. You can find the announcement for 4.5.3p1 here:

    http://forum.unity3d.com/threads/unity-patch-releases.246198/#post-1734940

    Any additional feedback you can provide will be greatly appreciated!

  9. 8b1a42e8bcbf816696f60a10cfa3b940?d=mm

    JoshPeterson

    Aug 01, 2014 15:29

    As mentioned in the updated description, I have a few more fixes for this issue ready in 4.5.3p1. As Dave Hampson mentioned earlier, the code to launch Visual Studio seems to be a bit more complex than expected. The complexity likely stems from the variation in possible Visual Studio installations. In any case, these changes have made the code in Unity a bit more robust, and hopefully will eliminate problems for many users.

    Specifically, we were seeing problems while a new session of Visual Studio was launched. Often Unity would try to communicate with the new session when it was busy. This caused Unity to give up and fall back to some default editor (often MonoDevelop). In some configurations, MonoDevelop cannot be launched, and Unity falls back to the default editor for .cs files defined on Windows. This could be a certain version of Visual Studio or even Notepad!

    With these changes, Unity will try to communicate with Visual Studio again after getting a busy response. During my testing, Visual Studio was often ready after only one or two retries.

    In addition, I've added a good bit of logging to the editor log when Unity attempts to launch Visual Studio. I hope these logs will allow us to troubleshoot problems related to specific Visual Studio installation configurations.

    @DFT GAMES: I'm relatively confident that this change will correct 608211 as well.

    @YOTZEE: The default time out for communication with Visual Studio is 5 seconds, with retries every 50 milliseconds. This is not a value that can be modified by the user in 4.5. I'm interested to get your feedback about this with 4.5.3p1. If you feel need to increase this timeout, we could consider making it a preference in 5.0.

    @DEKON: I was not able to reproduce the problem in your specific case (with VS Ultimate 2013 and VS Shell 2010). I believe that if this is still a problem in 4.5.3p1, the additional logging may help use track it down. Please follow-up if you have a chance to try this with that patch release when it is available.

  10. 3cc36e703ec9d45a2b9d8b6a876ab499?d=mm

    DeKon

    Jul 23, 2014 18:00

    I'm using 4.5.2f1. And i have installed Visual Studio Ultimate 2013 and Visual Studio Shell 2010 (not visual studio itself). I have the problem, that if i set VS2013 as Script Editor in Unity , but on double clicking it runs VS2010! So i can't launch VS2013 from Unity, but if i run manually from explorer, VS2013 does not see unity classes (moreover, VS2010 does not see it too). I have reinstalled both Unity and VS, but there is no result. In older version of Unity (4.2.2) everything works fine.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.