Program does not contain a static 'main' method suitable for entry point

xXProdigalXx picture xXProdigalXx · Apr 9, 2012 · Viewed 9.6k times · Source

I know that this question has been asked a lot, but none of the solutions seem to work for me. That or I am just incompetent and need to have my hand held through this problem (most likely solution). I looked through all of the classes, and all the build actions are set to compile, so I have no idea what could have gone wrong. Any help?

Additional Details: I have been coding the starting of a game, and everything was going good until I got this error:

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

All progress on this project has halted since this error appeared, and I could not find a way to fix it anywhere.

Answer

EJSawyer picture EJSawyer · Mar 14, 2013

I started getting this error on a WPF4/VS2010/MVVMLight app. All suggestions came up fruitless, until I came to the one about creating a new app and comparing the project and XAML files. This sounded like a desperate stab in the dark, but I went ahead and tried it.

After looking at several other files (thank heaven for BeyondCompare!), I discovered that my App.xaml had acquired an extra resource dictionary:

    <Application.Resources>
      <!--Global View Model Locator-->
      <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
      <ResourceDictionary>
        <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
        <ResourceDictionary.MergedDictionaries></ResourceDictionary.MergedDictionaries>
      </ResourceDictionary>
    </Application.Resources>

Removing the ResourceDictionary block fixed the problem. I still have no idea how this occurred (I wasn't editing app.xaml when this started), and it's not clear why VS reported this as the "static 'Main' method" error. Very strange.