Could not find 'WindowsFormsApplication1.Program' specified for Main method after renaming name space

Mausimo picture Mausimo · Mar 2, 2012 · Viewed 23.8k times · Source

I have a C# app that had the default namespace WindowsFormsApplication1.

I decided that I would like to use a different namespace so I renamed WindowsFormsApplication1. Now when I compile I get the error:

Could not find 'WindowsFormsApplication1.Program' specified for Main method.

To rename the namespace I highlighted the namespace in a file and hit F2.

How do I resolve this and change the actual namespace through out the project?

I am using Visual C# 2010 Express.

Answer

Mausimo picture Mausimo · Mar 2, 2012

In project -> properties change "startup object" to the new namespace.

Select Startup Object