我在 Visual Studio 2022 预览版 3 上处理 MAUI 项目。在编译时,我收到以下警告:
CS8785 'CodeBehindGenerator' 无法生成 MauiXaml
然后后面的代码没有生成,所以项目没有编译。对于 xaml 文件,生成操作设置为 MauiXaml。有修复代码生成器的已知方法吗?
我已经尝试过的:
- 通过 Visual Studio 安装程序修复了 Visual Studio
- 删除 bin、obj、.vs 目录并重新启动 VS
- 运行 maui-check ok(见下面的结果)
¤ .NET MAUI Check v0.7.3.0 ¤
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
This tool will attempt to evaluate your .NET MAUI development environment.
If problems are detected, this tool may offer the option to try and fix them for you, or suggest a way to fix them
yourself.
Thanks for choosing .NET MAUI!
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
» Synchronizing configuration... ok
» Scheduling appointments... ok
> OpenJDK 11.0 Checkup...
- 1.8.0-25 (C:\Program Files\Android\Jdk\microsoft_dist_openjdk_1.8.0.25)
- 11.0.10 (C:\Program Files\Microsoft\jdk-11.0.10.9-hotspot\bin\..)
> Visual Studio 17.0.0-pre.3.0 Checkup...
- 17.0.0-pre.3.0 - C:\Program Files\Microsoft Visual Studio\2022\Preview
> Android SDK Checkup...
- emulator (30.1.5)
- build-tools;30.0.2 (30.0.2)
- platforms;android-30 (3)
- system-images;android-30;google_apis;x86 (9)
- platform-tools (30.0.4)
- cmdline-tools;3.0 (3.0)
> Android Emulator Checkup...
- Emulator: tablet_pie_9_0_-_api_30_-_x64 found.
> .NET SDK Checkup...
- 5.0.400 - C:\Program Files\dotnet\sdk\5.0.400
- 6.0.100-preview.7.21379.14 - C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14
> .NET SDK - Workload Deduplication Checkup...
> Edge WebView2 Checkup...
- Found Edge WebView2 version 92.0.902.67
> .NET SDK - Workloads (6.0.100-preview.7.21379.14) Checkup...
- android-aot (Microsoft.NET.Sdk.Android.Manifest-6.0.100 : 30.0.100-preview.7.110) installed.
- ios (Microsoft.NET.Sdk.iOS.Manifest-6.0.100 : 15.0.100-preview.7.230) installed.
- maccatalyst (Microsoft.NET.Sdk.MacCatalyst.Manifest-6.0.100 : 15.0.100-preview.7.230) installed.
- tvos (Microsoft.NET.Sdk.tvOS.Manifest-6.0.100 : 15.0.100-preview.7.230) installed.
- macos (Microsoft.NET.Sdk.macOS.Manifest-6.0.100 : 12.0.100-preview.7.230) installed.
- maui (Microsoft.NET.Sdk.Maui.Manifest-6.0.100 : 6.0.100-preview.7.1345) installed.
- wasm-tools (microsoft.net.workload.mono.toolchain.manifest-6.0.100 : 6.0.0-preview.7.21377.19) installed.
- microsoft-net-sdk-emscripten (microsoft.net.workload.emscripten.manifest-6.0.100 : 6.0.0-preview.7.21377.2)
installed.
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
- Congratulations, everything looks great!