NETSDK1135SupportedOSPlatformVersion10.0.19041.0不能高于TargetPlatformVersion7.0

c#

我正在尝试将 .NET Framework WPF 应用程序转换为 .NET 5

我运行了https://github.com/dotnet/try-convert,并删除了一些不兼容的 DLL 引用。

现在,当我尝试编译时,我会看到

NETSDK1135  SupportedOSPlatformVersion 10.0.19041.0 cannot be higher than TargetPlatformVersion 7.0

关于寻找什么的任何想法?有问题的项目是 .NET 5 和 .NET Standard 2.1 的组合

回答

几个小时前我遇到了同样的错误。我发现这篇文章很有用:https :
//nicksnettravels.builttoroam.com/net-5-tfms/ 据我了解,项目文件中的 TargetFrameWork 必须包含与 SDK Contract 相同的 Windows 版本。我的项目文件现在看起来像这样:

  <PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
<UseWPF>true</UseWPF>

...

  <ItemGroup>
    <PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.1.0" />
    <PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
  </ItemGroup>

...

希望对你有用。


以上是NETSDK1135SupportedOSPlatformVersion10.0.19041.0不能高于TargetPlatformVersion7.0的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>