wpf 类型名称“App"不存在于类型中...重命名 MainWindow 后发生 [英] wpf The type name 'App' does not exist in the type ... occurs after renaming MainWindow

查看:22
本文介绍了wpf 类型名称“App"不存在于类型中...重命名 MainWindow 后发生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个简单的 WPF 中,我已将 MainWindow 类重命名为 MyClass,但在 App.g.cs 中出现此错误:

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();
    }

我如何解决在 Internet 上找不到任何内容的问题?

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.

这篇关于wpf 类型名称“App"不存在于类型中...重命名 MainWindow 后发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆