Cannot select Main Method as Startup object in Visual Studio Express 2010?

visual-studio-2010

Solution

I had this trouble after moving a class into a new namespace. Try closing the solution and manually editing the .csproj file:

<PropertyGroup>
  <StartupObject>MyNamespace.MyClassWithMain</StartupObject>
</PropertyGroup>

Problem

I have written a Main method in one of my classes. My startup Object says `Not set`. When clicking on it nothing else shows in the dropdown menu. Why can't I select the main method to be my Startup Object? I want to run my Main Method only by pressing ctrl+F7 but when doing so, nothing happens. Below is the very short Main method that I am using. ``` static void Main(string[] args) { Program c = new Program(); c.consoleread(); } ```

Original source