【发布时间】:2022-11-12 19:00:49
【问题描述】:
我有一个基于 .Net Framework 4.8 并使用 Windows Application Packaging Project 打包的 WPF 项目。当我尝试将其升级到 .Net Framework 4.8.1 以支持 ARM64 时,我在 Nuget 恢复期间收到 NU1201 错误。
NU1201:WpfApp7 项目与 uap10.0.18362(UAP,版本 = v10.0.18362)不兼容。项目 WpfApp7 支持:net481 (.NETFramework,Version=v4.8.1)
我试图将所有内容削减到最小的可重现回购here:
有2个tags:
netframework48和netframework481它们的区别在于在项目属性视图中切换到“.Net Framework 4.8.1”:
在
netframework48上,运行nuget restore .\WpfApp7.sln成功恢复包,而在netframework481上,相同的命令失败并显示以下错误消息。> nuget restore .\WpfApp7.sln MSBuild auto-detection: using msbuild version '17.3.1.41501' from 'd:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin'. Assets file has not changed. Skipping assets file writing. Path: D:\Work\temp\WpfApp7\WpfApp7\obj\project.assets.json Restored D:\Work\temp\WpfApp7\WpfApp7\WpfApp7.csproj (in 69 ms). Restoring packages for D:\Work\temp\WpfApp7\WpfApp7.Package\WpfApp7.Package.wapproj... NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362). Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-arm. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-arm-aot. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-arm64-aot. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-x64. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-x64-aot. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-x86. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-x86-aot. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) Assets file has not changed. Skipping assets file writing. Path: D:\Work\temp\WpfApp7\WpfApp7.Package\obj\project.assets.json Failed to restore D:\Work\temp\WpfApp7\WpfApp7.Package\WpfApp7.Package.wapproj (in 500 ms). Errors in D:\Work\temp\WpfApp7\WpfApp7.Package\WpfApp7.Package.wapproj NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362). Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-arm. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-arm-aot. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-arm64-aot. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-x64. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-x64-aot. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-x86. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NU1201: Project WpfApp7 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362) / win10-x86-aot. Project WpfApp7 supports: net481 (.NETFramework,Version=v4.8.1) NuGet Config files used: C:\Users\arieszhang\AppData\Roaming\NuGet\NuGet.Config C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.FallbackLocation.config C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config Feeds used: C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ https://api.nuget.org/v3/index.json 1 of 2 projects are up-to-date for restore.搜索了一圈,但仍然没有弄清楚这个错误的确切含义?以及如何解决这个问题?在我的项目中,既没有项目依赖项,也没有从 NetStandard 到 NetCoreApp 的依赖项,正如错误的 definition 所说。
我已经尝试了 WpfApp7.Package 属性中的每个 UWP 目标,但无论选择哪个最低版本,错误仍然存在,因此我假设 UWP 目标版本不太可能是原因。
同样的问题也在这里交叉发布:https://github.com/NuGet/Home/discussions/12206
2022 年 11 月 12 日更新: 在上面的 github 问题中有一个很好的答案。请在此处查看:https://github.com/NuGet/Home/discussions/12206#discussioncomment-4082656。
【问题讨论】:
标签: c# .net wpf nuget .net-4.8