In a simple WPF, I have renamed MainWindow class to MyClass and I got this error in App.g.cs:
public static void Main() {
MyClass.App app = new MyClass.App();
app.InitializeComponent();
app.Run();
}
How can I fix this can't find anything on the internet ?
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"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With