Editor opening random versions of VS

Hi,

Recently updated to 2020 (happens on both b4 and b5) and I’m getting an issue where scripts randomly open in random versions of visual studio which I have a few versions of because I’m a goober.

I can’t really see a pattern and it’s not too bad but just thought I’d post it and see if anyone had a fix.

1 Like

Same problem for me. Installed versions are Visual Studio 2019 Community and Visual Studio 2015 Community.
The External Script Editor setting is set to Visual Studio Community 2019 but Unity opens 2015 most of the time. I tried selecting the 2019 Executable directly but that didn’t make a difference.

Occasionally it opens raider which I also have - one thing I also noticed was especially when it does this, it wants to reload files

Are you using the Visual Studio package? You can see this under the package manager.
If not, try adding this package.

Yep already had that, and checked it was updated.

1 Like

Hello,

Several questions for you:

  • Just to double check, could you confirm the exact version of the VS package you are using?
  • In Unity what do you see in Edit/Project Settings/Editor/Additional extensions to include (C# Project Generation)
  • Do you think it is really random, or perhaps more related to the extension of the file you are trying to open.

Thanks!

well…

so far the new beta hasnt done it… but it was definitely random as you’d double click get vs and double click same file expecting it to bring vs to the front and it would load rider…

We saw that with an initial version of the package (1.x). The package was not properly recognizing the extension as handled by VS, and instructed Unity to fall back to the default system Editor for this extension.

But with version 2.x+ it should be resolved.

OK it just happened again but when i closed rider which i hadnt even actually had open the file I wanted, i noticed vs had a dialogbox with reload file… im wondering if its picking another editor because vs has a dialogbox up and isnt responding

I’m using 2.0.1. I can force it to use VS2017 by regenerating the project files, but it seems to revert occasionally.

mine seems to have stopped now i changed windows to default to having cs files opened by the same version of vs. It seems then randomly it skips the one you select and tries the windows default

Indeed, when a modal Window is opened in VS, Unity is unable to communicate anymore and will fallback to the default system handler for the file extension used.

Could you give us your exact VS version ?

I have a similar issue ( Bug c# files open in notepad until manually edited - Unity Engine - Unity Discussions ) in that files will open in notepad until an edit is made. I do have the package installed and it didn’t happen in 2020 b2. I’m using VS 2017 Community 15.9.14

I have 15.9.22 and 16.5.4 (should be using the latter by request)

Hello, this might be relevant:
https://discussions.unity.com/t/789496

Also:
5817589--616258--upload_2020-5-7_21-1-48.png

I answered on your thread, but I think in your case it is a Unity bug or another package conflicting with project generation.

Ok so I think we fixed the issue. Until we release a new package, a possible workaround is to use “Asset/Open C# project” once, everytime Unity is launched, to properly initialize the state and open Visual Studio. Then you should be able to open scripts properly from Unity.

Sorry for this.

4 Likes