Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
864 views
in Technique[技术] by (71.8m points)

asp.net mvc - A project with an Output Type of Class Library cannot be started directly.

When I try to run my application, I ge the the following error; enter image description here

I know this issue has come up many times, and the usual answer is to right click on the appropriate project and make it the start up project.

Well I have done that and this does not fix it.

My application is an MVC application, so the start up project should be a class library.

It was working fine until I tried to upgrade it to MVC5.

I am working on VS 2012.

I am wondering if the problem was caused by unloading and reloading the csproj file which I edited as part of the upgrade?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I think it might have something to do if there are multiple projects in the solution. I was getting the same problem when I had a MVC project and the testing project in the same solution. What fixed it for me was setting the MVC project as the StartUp project. This is done by right clicking on the MVC project and selecting "Set as StartUp Project".

This works for VS2013 Professional


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...