Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

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

visual studio - A project with output type of class library cannot be started directly - with a startup exe

Firstly I'm completely aware of this message and why it happens normally. It's not that I'm just trying to run a dll (like this question).

I have a project that compiles to a dll but has a startup program specified in the project properties. Most of the time I'm able to right-click on the project and select Debug > Start new instance, and it will run the program and let me debug my dll. However, occasionally I get this message (A project with output type of class library cannot be started directly) as if I haven't got a startup program. The first few times I thought it was just me accidentally clicking on the wrong project but I'm certain this isn't the case given that it's happened so many times and I've been careful to watch it.

When this message appears I'm able to try it again and it always works on the second or third attempt.

A colleague using the same Solution never has this problem :-/

Anyone else had this problem or know how to solve it?

I'm using Visual Studio 2005 Pro Version 8.0.50727.762 (SP.050727-7600) Edit: Also happens with Visual Studio 2010

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

Another colleague suggested it's because after clicking Debug > Start new instance, while I'm waiting for it to start up, I click on a different project. I don't do it for any reason, just randomly selecting things as I wait for the project to start up. Maybe Visual Studio looks at the selected project sometime after I clicked the menu, gets confused, and shows the error message?

Anyone able to confirm this matches their experience?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...