大概率是start up project设置有问题:
Solution Explorer -> 列表中选取正确的project右击 -> Set as Startup project -> 重新build
“Just right click on the Project Solution A window pops up. Expand the common Properties. Select Start Up Project
In there on right hand side Select radio button with Single Startup Project Select your Project in there and apply.
That’s it. Now save and build your project. Run the project to see the output.”
Reference:
https://stackoverflow.com/questions/3363106/a-project-with-an-output-type-of-class-library-cannot-be-started-directly