Why does each C# script open in a new separate instance of Visual Studio?

I’m working on a project and it is OK. I open various C# scripts and each one opens in a new tab in the single running instance of Visual Studio Community 2015. To make a backup of the project, I copied and pasted it and then renamed it. I then opened that copied project in Unity, but when I open various C# scripts and each one opens in a completely new instance of VS2015.

I’ve been doing this way of making backups then opening the copies for years and this has never happened before.

What is going on?

NOTE: Disregard this. It was fixed by deleting all the .csproj and .sin files.

2 Likes

Under the main project directory, you need to delete the {projectname}.csproj, {projectname}.Editor.csproj, and the {projectname}.sln files.

2 Likes

I had this problem as well, I believe it was related to upgrading a project to a new version of unity. I resolved it by deleting the .csproj files and the .sln file for the project. Unity just recreated them immediately, and the files correctly opened in the same instance of VS.

This is happening to me now. deleting those files doesn’t fix it. I just upgraded to 2020.1.6f from 2019.4.3f

4 Likes

The same here. I just removed Visual Studio Editor package from Package Manager, and the problem looks like fixed now

8 Likes

THANK YOU OH MY GOODNESS. These multiple instances were so frustrating because if I didn’t notice, every time I tried to save it would tell me “you’ve edited this file externally” and I would have to resolve like 5 windows.

Do you know what the difference is between the “Visual Studio Editor” and the “Visual Studio Code Editor” ? Just out of curiosity…

2 Likes

VS code is a completely different IDE. It’s free and very customisable, but I don’t like it myself…

I’ve logged a bug to unity about this multiple instances issue but they’re struggling to reproduce it. Please log a bug with a new empty project that reproduces the bug as that may help them.

Wow, that worked for me, thank you so much.
A lot of answers on internet just mention to delete the project files (which did not work for me).

please log a bug with unity. They seemed to think it was something specific to me and my project but it’s obviously not. the more people that log it the better chance they’ll resolve it.

THANK YOU!!! Nothing else worked. You have saved me countless headaches and precious minutes.

I have to remove both “Visual Studio Code Editor” and “Visual Studio Editor” packages, restart unity and THANKS GOOD!

Removing VS editor did not work UNTIL i restarted the project.

Unity 2020.20b7

Issue seems to be with the editor package, although ive always had issues using VSCode (not VS) with unity on macOS, specifically with the IDE knowing what unityengine classes are and being able to quick fix classes that havent been imported

I heard back from QA at unity. Apparently it’s to do with the automation permissions for unity hub and VS being disabled in the latest MacOS. Open your security settings find automation in the list and see if you can turn them back on.

in my case i cannot because the applications are not in MacOS security automation settings to allow me to turn them back on. :confused:

I’m not sure how to add them and haven’t got a reply about it yet.

fixed it for me too! 3 years later! :smile:

In my case (Windows 10, VS Community 2019 and Unity 2020.1.9), nothing of the above worked, but I noticed the problem didn’t reproduce when I changed project’s path.
Don’t know what was wrong with the folder/subfolder name. No special characters or too many subfolder levels.
A new project in the same folder than the original didn’t work, but creating or moving it to a different folder was fine.

Thank you! fixed it. you save my time!

In my case using unity 2020, this happen after I update Visual Studio. Therefore, you need to update visual studio editor at unity also.

Unity > Window → Package Manager > select unity Packages: In Project > Visual Studio Editor > Click Button Update

I have the same problem, but I notice it only happens when I create a new script, and only the first time I open that script. If I close the new instance of VS then reopen the script, it will go to the VS I already had open. Win 10, Unity 2020.2

Won’t removing the VS editor package also remove intellisense and VS actually knowing what the Unity classes are?

1 Like

I too am nervous about removing the editor package, worried that will make things worse and not better. Can anyone confirm what removing the package does?

You don’t need to worry. I removed it and it seemed ok. You can always add it back in.

Fyi this bug seems fixed now, I’m on the latest VS on macOS and the latest unity and packages.