"A Project with an Output Type of Class Library Cannot Be Started Directly"

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

The project you have downloaded compiles into a dll assembly and provide a set of classes with implemented functionality.

You should add to your solution a new project with Output Type of either Console Application or Windows Application (VS Add Project wizard will offer you different templates of Projects).

In the newly added project, you can implement logic to test your Class Library.

Output type of the project you can find and change by the following steps:

  1. Right click on project in Solution Explorer -> Properties.

  2. In opened tab with properties select Application and there will be ComboBox marked with Output Type label.

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

The project type set as the Start-up project in that solution is of type ClassLibrary. DUe to that, the output is a dll not an executable and so, you cannot start it.

If this is an error then you can do this:

A quick and dirty fix for this, if that is the only csproj in the solution is to open the .csproj file in a text editor and change the value of the node <ProjectGuid> to the Guid corresponding to a WinForms C# project. (That you may obtain from a google search or by creating a new project and opening the .csproj file generated by Visual Studio to find out what the GUID for that type is). (Enjoy - not many people know about this sneaky trick)

BUT: the project might be a class library rightfully and then you should reference it in another project and use it that way.

ERROR: A project with an output type of class library cannot be started directly

Your Output type is Class Library. You cannot start a class library, because it compiles to a dll, not an exe. It is intended to be used by other projects.

If you want to start that project, you should create a project of type like Console Application, or WPF Application.

Each project that can be started needs an entry point, for Console Applications this is typically a static main method in Program.cs, e.g.:

class Program
{
static void Main(string[] args)
{
}
}


Related Topics



Leave a reply



Submit