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

cdllentity-frameworknet

I've Got sample code with C#. but when I run Program I get the error message like this:

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.

I'm searching in for the output . i got Answer for solving . I try that too but i m not getting any thing.

this is my Application:

enter image description here

help me to get Output . what i need to do for this Error. I m also tried to select the project to "set as startup project" but still the same error appears. Please help

Best Answer

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)
    {
    }
}