deltanovember
deltanovember

Reputation: 44051

Program does not contain a static ‘Main’ method suitable for an entry point

What do I do if I just want to create a project which contains a bunch of library functions? In other words no Main method is required. It seemed to be compiling a minute ago and then I added another .cs file and now I am confronted with this error message.

Upvotes: 8

Views: 14829

Answers (6)

kiran bhujang kadam
kiran bhujang kadam

Reputation: 1

This problem is occured when we deleted App.xaml file from our project after the required method written due to that please ensure that your App.xaml file is in correct format with respective namespace and references, if it is not, create it and add it in your project.

Upvotes: 0

Michael Bray
Michael Bray

Reputation: 15265

Create a .NET Class Library project if you only want a library project. If this is a project that already exists, you can set the Project Output type to a DLL ("Class Library") instead of an Executable ("Windows Application"/"Console Application") in the project properties.

Upvotes: 22

dieer
dieer

Reputation: 11

I have the solution. Really simple. You wrote the static void main with lower case. You should write it like this: static void Main()

Upvotes: 0

mike
mike

Reputation: 1

or you could use the tried-and-true empty main method

Upvotes: 0

ddc0660
ddc0660

Reputation: 4052

You want to make the project a Class Library type. I believe you can change the type of project in the project properties settings.

Upvotes: 1

Andrew Hare
Andrew Hare

Reputation: 351516

What type of project did you create? It sounds like you meant to create a class library but accidentally created an executable assembly. Ensure that you are in fact creating a class library assembly (i.e. ".dll" not ".exe").

If you aren't using Visual Studio and are compiling your code with csc.exe then make sure that you are specifying /target:library to compile your code into a library.

Upvotes: 4

Related Questions