Go to content Go to navigation Go to search

Visual Studio 2005 Looking For a Static 'Main' Method When Compiling a Library Project

I was building a web project in Visual Studio 2005 and got this error message:

Error 8 Program ‘C:\Path\to\Library.exe’ does not contain a static ‘Main’ method suitable for an entry point

It turns out that the project was, for some reason, set to build as an executable. The solution is to get the project to build as a library.

I opened up the project’s .csproj file in my favorite text editor, found the /Project/PropertyGroup/OutputType node (about line 20) and changed its value from:

<OutputType>Exe</OutputType>

to

<OutputType>Library</OutputType>

I saved my changes and then let Visual Studio reload the project.