wpf The type name 'App' does not exist in the type ... occurs after renaming MainWindow

I accidentally got this error, in my case I had a class with the same name as the namespace. Renaming the class solved the problem.


Do not name a class the same as its namespace

Check out if you don't have a class somewhere in your project that has the same name as your namespace!

for example:

namespace HashCalculator
{
  public class HashCalculator

App.g.cs is produced by compiling App.xaml into C# code. The problem is in your App.xaml. Without seeing it, I can't be sure exactly what, but you probably just need to alter the StartupUri to StartupUri="MyClass.xaml".

Tags:

Wpf