这是 .net MAUI 的模板项目。选择新的解决方案后,我使用 Jetbrains IDE 界面创建一个新的 .net MAUI 项目。默认版本是 Pixel 5,这曾经可以工作,但现在显示以下错误。
0>Xamarin.Shared.targets(874,3): Error : /usr/bin/xcrun exited with code 1
0>Xamarin.Shared.targets(874,3): Error : actool exited with code 1
0>Assets.xcassets: Error actool: The operation couldn’t be completed. Failed to locate any simulator runtime matching options: {
BuildVersionString = 21A326;
Platforms = (
"com.apple.platform.iphonesimulator"
);
VersionString = "17.0";
}
这不仅仅适用于一个项目,我在所有 .net MAUI 项目上都遇到此错误。
之前,我有更多设备,例如 iPhone 可用,但在创建新项目或启动旧项目后,这些选项似乎消失了。我不确定错误从何而来,也不知道它何时或为何开始,因为它之前工作正常。
值得注意的是,在 Visual Studio 中,此问题仍然存在,并出现相同的错误;但仅限于“通用模拟器”选项。 Pixel 5 也是一个选项,但这次它给出了不同的错误。在 App.xaml.cs 中:
Microsoft.Maui.Controls.Xaml.XamlParseException
Position 9:37. Cannot assign property "Source": Property does not exist, or is not assignable, or mismatching type between value and property
如果有任何帮助,我将非常感激,因为这是一个年级,而我的老师没有提供任何帮助,因为他们认为拥有一台 Mac 需要我自己承担风险。
更新到 Rider 2023.3.1 后,我遇到了同样的问题。
您必须启动 XCode。将出现一个对话框,要求您选择开发平台。您应该选择 iOS 17.X...(在我的例子中为 17.2) 之后,将安装模拟器。这可能需要一段时间。 安装后,重新启动 Rider,您应该能够构建。