Fix: A project with an Output type of Class Library cannot be started directly

You will sometimes come across the following error in a message box if you execute an ASP.NET application using Visual Studio 2005/2008

A project with an Output type of Class Library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project. 

Resolution

In order to fix the above error, right click the Solution name in Visual Studio 2005/2008 and select Set as StartUp Project option from the popup menu.

Applicability

Visual Studio 2005
Visual Studio 2008

14 Responses to "Fix: A project with an Output type of Class Library cannot be started directly"

  1. Yoav   July 27, 2009 at 12:16 am

    Thank you so much!

    Reply
  2. Pingback: Fix: A project with an Output type of Class Library cannot be started directly - I type what I feel - MSMVPS.COM

  3. Bobby   March 6, 2010 at 6:07 pm

    Thank you, it worked!!

    Reply
  4. Alex   March 12, 2010 at 3:44 pm

    Thank You!

    Reply
  5. Salim   March 16, 2010 at 12:00 am

    Thanks alot dear!!!
    IT WORKED

    Reply
  6. Babak   April 7, 2010 at 1:57 pm

    It did not work. This has worked for me in the past, but not this time. I have r-clicked on default.aspx, I have chosen it as the startup page, and I have default.aspx open as I hit the debug button.

    Reply
  7. Mariner Eccles   September 20, 2010 at 3:07 pm

    This did not work for me. What I did was I took a project written on VS2008, converted it to VS2010, and got the error on debugging. When I attempted the resolution, I still got the error. So how would this work in VS2010, or can VS2008 projects that get converted to VS2010 lose debug cappabilities?

    Thanks.

    Reply
  8. DLeh   January 14, 2011 at 10:01 am

    Works in vs2010 too, for reference.

    Reply
  9. Euclides Marques   January 26, 2011 at 7:03 am

    Thanks !!!

    Reply
  10. KONAH   June 3, 2011 at 2:07 am

    THANKS!it works!!

    Reply
  11. SMR   July 11, 2011 at 1:31 pm

    thanks alot…

    Reply
  12. Swetha   September 12, 2011 at 8:26 pm

    Thanks a ton, it solved one of my big problem in running the code and debuggin it !!!

    Reply
  13. Rubi86   September 23, 2011 at 6:02 pm

    Thankyou. It Works!

    Reply
  14. koajca   January 3, 2012 at 2:56 am

    Thank you! 😀
    It workds!

    Reply

Leave a Reply

Your email address will not be published.