Learn how to solve the message error when importing a third party (or personal) project in to visual studio.

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

This error will ocurr when the project you're working with compiles into .dll assembly and provide a set of classes with implemented functionalities.

The project creates only a DLL, it has no executable to run, therefore you need to add a solution to your project with Output Type either Console Application or Windows Application (Winforms).

Once your project has a solution with any of the previous mentiones types (or maybe is a third party project and it already has but it isn't configured), just follow these steps in Visual Studio to solve your issue easily.

Solution

Right click on the Solution Explorer of your project in the right top corner of the IDE and the select the Properties option located in the dropdown menu.

Visual studio output type of class library step 1

Now from the Solution Property Pages dialog that appears, select the StartUp Project list option. From the list of radio buttons, select the Single startup project and select from the list the solution create previously (or the one with Output), in this case the solution type is of WinForms.

Select it, apply changes and click OK.

A project with an output type visual studio

Finally, go again to the Solution explorer and right click on the solution. Click on Clean Solution and finally build your project again.

Clean solution and build

The problem now should be solved, have fun !


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors