NETSDK1135 SupportedOSPlatformVersion 10.0.19041.0 不能高于 TargetPlatformVersion 7.0 [英] NETSDK1135 SupportedOSPlatformVersion 10.0.19041.0 cannot be higher than TargetPlatformVersion 7.0

查看:55
本文介绍了NETSDK1135 SupportedOSPlatformVersion 10.0.19041.0 不能高于 TargetPlatformVersion 7.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我运行了

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

解决方案

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

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

...

 <PackageReference Include="Microsoft.Windows.CsWinRT";版本=1.1.0"/><PackageReference Include="Microsoft.Windows.SDK.Contracts";版本=10.0.19041.1"/></项目组>

...

希望对你有用.

I am trying to convert a .NET Framework WPF app to .NET 5

I ran https://github.com/dotnet/try-convert, and removed some incompatible DLL refs.

Now, when I try to compile, I am presented with

NETSDK1135  SupportedOSPlatformVersion 10.0.19041.0 cannot be higher than TargetPlatformVersion 7.0

Any ideas as to what to look for? The project in question is a combination of .NET 5 and .NET Standard 2.1

解决方案

I had the same error a few hours ago. I found this article useful: https://nicksnettravels.builttoroam.com/net-5-tfms/ As I understand the TargetFrameWork in the project file must include the same Windows version as the SDK Contract. My project file looks like this now:

  <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>

...

Hope it is useful for you.

这篇关于NETSDK1135 SupportedOSPlatformVersion 10.0.19041.0 不能高于 TargetPlatformVersion 7.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆