I have managed to accidentally interrupt the process of Visual Studio opening a script file in my project - simply by clicking back on Unity before VS finished opening.
As a result I now get the error:
“The project ‘<PROJECT_NAME>’ cannot be added to the solution because a project with the same project filename already exists in the solution.”
This also results in all sorts of things not working like newly added scripts not compiling it would seem.
The first time this happened I tried all sorts of things (like rolling back using collaborate, trashing the sln file etc. but nothing worked). Eventually I just had to manually rebuild the entire project by creating a new project and re-importing everything.
And now it’s happened again.
Does anyone know a way to resolve this? I can’t believe it doesn’t crop up more as it is very easy to accidentally do! Please tell me I don’t need to rebuild my whole project again sobs
Never once run into this. And I have clicked back on Unity while a script is opening several times.
When does this error pop up for you?
Interesting… the error pops up every time I open a script (for that particular project). Ah I’ve just noticed that it’s actually saying: <PROJECT_NAME>.Editor rather than just <PROJECT_NAME>…
Just to add… now that I think about it it hasn’t happened to me much in the past but has been happening on recent projects and I’m wondering if it’s because I’ve changed over to .NET 4.6…
Maybe something messed up and wrote the project file into the sln file twice. The sln file is just xml so you can open it in a text editor and check for duplicate entries.
Many thanks @eisenpony ! That was it - duplicate entries in the .sln file. Unity seems to have changed its mind about the unique identifier strings associated with the projects and so had duplicate entries. I had to delete what I assume were the old ones and everything (seems) to be fine now… Cheers!
I have never had this issue before but now using VS 2017 and the unity 2019.2 I had 17 duplicate projects! This was a small project I had just started so I just deleted and recreated and the same thing happened again. Has to be a bug in Unity