开发者

'Set as startup project' setting dissapearing

开发者 https://www.devze.com 2022-12-30 17:14 出处:网络
I have a solution with a bunch of projects in it.The \'startup\' project is a ASP.NET MVC Web Application.

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开发者_开发知识库?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消