启动 MAUI 应用程序加载时充满错误
我正在尝试按照 MS 官方文档中的教程启动 dotnet MAUI 应用程序 我只是打开启动 MAUI 项目(内置默认项目),VS22 就没有它。我收到了 40 多个错误,其中大多数是关于引用缺失和类/函数重复的
现在我已经看到了 在这里发帖有一些相同的问题但解决方案(使用 dotnet Workload intall 从 CLI 重新启动和下载工作负载)对我来说不起作用。
我没有对代码进行任何更改,所以我真的不明白这里有什么问题。
任何帮助将不胜感激。
编辑1: 当我运行 Android 模拟器时,该应用程序似乎可以正常工作......这使得它更加奇怪
I'm trying to start a dotnet MAUI app following the tutorial of MS in their official docs
I'm just opening the startup MAUI project(the built-in default one) and VS22 just won't have it. I get 40+ errors most of them about reference missing and duplication of classes/functions
now I have already seen a post here having somewhat of the same problem but the solutions(restarting and downloading workloads from the CLI using - dotnet workload intall
) just didn't work for me.
I haven't done any changes to the code whatsoever so I really don't get what is the problem here.
any help would be appreciated.
Edit 1:
The app do seems to be working when I run the android simulator… which makes it even weirder
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前看来,这是工具中的一个错误。如果您查看错误,尤其是屏幕截图中的错误,您会发现这些错误涉及 Android。如果您稍微展开“项目”列,您将看到它所讨论的目标平台列表。
因为现在所有内容都在 1 个项目中,所以它会给出有关特定于平台的内容的错误,因为它只查看正在构建的一个目标。在这种情况下,也许您正在构建 iOS,但它会给出有关无法找到 Android 类型的错误。这是有道理的,但是,在这种情况下我们不应该看到这些错误。
这样解释有点困难,我希望它能有意义。
长话短说,这是一个错误,正在修复中。而且您应该能够忽略它们,并且它仍然会像您已经发现的那样运行。然而,它会产生很多噪音,如果存在实际错误,您必须在此列表中找到它并修复它。
This is a bug in the tooling at the moment it seems. If you look at the errors, especially the ones in your screenshot you can see that these talk about Android. If you expand the Project column for a little you will see the list of target platforms that it's talking about.
Because everything is in 1 project now, it gives errors about platform-specific stuff because it is only looking at that one target that it's building. In this case, maybe you were building iOS and it gives errors about not being able to find Android types. This makes sense, however, we shouldn't see these errors in this case.
It's a bit hard to explain like this, I hope it makes any sense.
Long story short, it's a bug, it's being worked on. And you should be able to ignore them and it would still run as you've already discovered yourself. It gives a lot of noise however and if there is an actual error, you will have to find that in this list and fix that.