错误 NETSDK1100:构建 Windows 桌面应用程序需要 Windows

Noe*_*her 3 c# macos visual-studio visual-studio-code

我是 Visual Studio for Mac 中的 C# 新手,我需要打开一个扩展名为“.sln”的项目。

当我尝试这样做时,会显示一条消息:

error NETSDK1100: Windows is required to build Windows desktop applications.
Unable to create package spec for project.
Run Code Online (Sandbox Code Playgroud)

我想我可以设法打开一些文件来修改代码并使其可以被 Mac 接受,但我不知道从哪里开始搜索。

smk*_*adl 5

从 net6 SDK 开始6.0.4xx,将可以在非 Windows 操作系统上构建 WPF/WinForms 项目。

它需要在或文件<EnableWindowsTargeting>true</EnableWindowsTargeting>中设置。csprojDirectory.Build.props

https://github.com/dotnet/docs/issues/30076