views:

681

answers:

3

I don't know how it happened, but for about a week now Visual Studio keeps switching the active project everytime I move between files (of different projects) in the same solution. Of course when I press F5 to start debugging or Ctrl+F5 to run the tests, it tells me that it can't start because the class library can't be started directly... It switched the active project again.

This is driving me nuts and I can't find a setting to turn it off. I've got the following addins installed:

  • ReSharper 4.5
  • TeamCity
  • AnkhSVN 2.0.something (latest)
  • GhostDoc
  • Gallio

I've enabled and disabled the Track Active Item in Solution Explorer option, but that didn't help.

Anyone an idea?

Thank you!


Updates:

  • I checked the ProjectGuid as suggested by sharptooth and all projects have a unique guid.
+1  A: 

This happens often if you copy a project file manually - then you have two projects with the same GUID in one solution and VS can't distinguish between them since it stores the GUID of the "active" project.

The solution is toopen each project file in a text editor (Notepad is just fine) and change the GUID. Use "Create GUID" tool to generate new GUIDs.

sharptooth
I checked all *.csproj files in the solution and they all have unique ProjectGuid elements.
__grover
+6  A: 
Anton Gogolev
Thanks that was it. Didn't of that dialog and don't remember changing it.
__grover
+2  A: 

There's an option "For new solutions use the currently selected project as the startup project" under "Projects and Solutions" -> "Build and Run" which could lead to this behavior.

Stanislav Kniazev

related questions