views:

53

answers:

2

I have a solution with a bunch of projects in it. The 'startup' project is a ASP.NET MVC Web Application.

I set it as the startup project (by right clicking on it in Solution Explorer and selecting 'set as startup project'. The project title goes bold and everything works fine for a while.

Then I will be editing one of the supporting projects, and come to click the 'Start Debugging' button, and bang - the 'project of this type cant be started' message.

I then check, and the web project is no longer set as the startup project. And so on....

Anyone know why this is happening?

+3  A: 

Try to close you solution, delete YourSolution.suo file in solution's root directory and open it again.

abatishchev
In addition, make sure you have write permission to that file and that there is no cleanup script that deletes that file regularly :)
mihi
Ok, will try that thanks. There are no cleanup scripts that I know of, and I know of no reason why I shouldn't have permissions on the file - will check.
UpTheCreek
This worked for a while, but a few days later it was back :/
UpTheCreek
@UpTheCreek: Sounds pity( Have you instaleld sp1?
abatishchev
Yes, sp1 is installed. I guess I will just periodically delete this file! By the way, do you know what else is stored in there?
UpTheCreek
@UpTheCreek: This is a special file to cache user settings like which items are shows in solution explorer and other temp settings. YOu can delete it with not doubt
abatishchev
+2  A: 

This can happen if the projects in the solution do not have unique ids. Each project file has an entry like this:

ProjectGuid = "{36910E05-3D05-4AC0-B90C-94F8F776CE5F}"

If you created your supporting projects by file-copying your startup project, they will still have the same id. The easiest way to check this is to open the solution file with a text editor. You'll know, that you have a problem, if you see two projects with different names, but the same id:

Microsoft Visual Studio Solution File, Format Version 8.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project1", "Project1.csproj", "{BAC18E5A-710F-4E5A-8DE3-822CE1AA5D38}"
    ProjectSection(ProjectDependencies) = postProject
    EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project2", "Project2.csproj", "{BAC18E5A-710F-4E5A-8DE3-822CE1AA5D38}"
    ProjectSection(ProjectDependencies) = postProject
    EndProjectSection
EndProject

Another symptom of this problem is, that you can not define dependencies between projects (i.e. Visual Studio keeps "forgetting" them).

To fix the problem, simply edit your project files to have unique ids and adjust your solution file accordingly.

Ralph
My file looks a little different (It says File Forrmat v10 not 8). Each project is listed like this:Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PROJECTNAME", "PATHTO.csproj", "{ED22D573-32FA-4983-ABB0-7E67B82C1557}"Where the fist GUID is the same for each project, and the second is unique for each project. Should they both be unique?
UpTheCreek
No, the second number is the ProjectGuid. All projects in the solution must have distinct ProjectGuids.
Ralph
Ok thanks, so it looks like that is not the problem then.
UpTheCreek