Why does my VB.NET app thinks it has to startup from the Class Library?
October 23, 2009 11:03 AM   Subscribe

I have my VB.NET app (which includes a Class Library and several Forms) set to startup from the Windows Forms Application. Why am I getting the error message: "A project with an Output Type of Class Library cannot be started directly?" I'm trying to tell it not to start from the Class Library! Please help.

I'm a newbie at this, so I'm standing by to offer clarification if my explanation of the problem doesn't make sense. What I have done is:

1. Created a project.
2. Added a Class Library containing a controller class and another class.
3. Created a Windows Forms Application with two forms and corresponding code.
4. Added the Windows Forms Application to the the project that already contains the Class Library.
5. In the Class Library, added a reference to the Windows Forms Application.
6. Set the project to start from one of the Forms.

Maybe it's worth noting that this app is also connected to a database.

I've been at this for hours and am losing my mind. Please help me!
posted by kitcat to Computers & Internet (6 answers total)
 
> 4. Added the Windows Forms Application to the the project that already contains the Class Library.

Simply, you need to run an application and not a class library. If you created an application and then added all the files to an existing class library, you're still trying to run a class library. Do the reverse (or reference the class library from the application (right click, add reference)).
posted by wrok at 11:06 AM on October 23, 2009


Best answer: Ohhh, right click on the application project, select "Set as Startup project"
posted by wrok at 11:07 AM on October 23, 2009


Ohhh, right click on the application project, select "Set as Startup project"

That was my thought after reading your description too, although it sounds like you already did that in the "Set the project to start from one of the Forms." step. The end result is that the app project should be bold in your Solution Explorer window.
posted by burnmp3s at 11:18 AM on October 23, 2009


That was my thought after reading your description too, although it sounds like you already did that in the "Set the project to start from one of the Forms." step. The end result is that the app project should be bold in your Solution Explorer window.

Correct, look for the bold!

I wasn't sure if a startup form (ala 'Set as Start Page' for web projects) or a startup project was chosen according to that text :)
posted by wrok at 11:29 AM on October 23, 2009


Response by poster: Ok, I'll do what it takes to get the application project bolded. Yes, I did notice that the Class Library was consistently the one bolded. I thought (hoped) maybe that didn't matter...
posted by kitcat at 11:36 AM on October 23, 2009


Response by poster: Setting the application as the startup project did the trick. And I guess I should have added the class library to the application and not the other way around.

Thanks!
posted by kitcat at 11:27 AM on October 24, 2009


« Older What's good website to request for items to...   |   Knife Sharpening Newer »
This thread is closed to new comments.