【问题标题】:Azure Pipeline: project.assets.json doesn't have a target for 'net48/win7-x64'Azure 管道:project.assets.json 没有“net48/win7-x64”的目标
【发布时间】:2021-12-22 21:26:45
【问题描述】:

我正在将旧应用程序转换为 Azure DevOps、.NET 4.8 和新项目格式。由于一些第三方,我目前无法移动到 net5 或 6。这个项目在 x86 和 x64 中生成程序集。两个平台都完美地在本地恢复和构建,但我在 Azure DevOps 上使用 x64 时遇到了故障。

##[error]C:\Program Files\dotnet\sdk\5.0.404\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): Error NETSDK1047: Assets file 'D:\a\1\s\src\BraccoUIComponents\obj\project.assets.json' doesn't have a target for 'net48/win7-x64'. Ensure that restore has run and that you have included 'net48' in the TargetFrameworks for your project. You may also need to include 'win7-x64' in your project's RuntimeIdentifiers.

我在Directory.Build.props 中有以下几行:

<TargetFramework>net48</TargetFramework>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<Platforms>x64;x86</Platforms>

我已经测试了https://github.com/dotnet/sdk/issues/1321 中列出的各种解决方案以及各种 SO 线程,但它们似乎都不起作用(TargetFrameworksRuntimeIdentifierRuntimeIdentifierswin-x64win7-x64...) .

【问题讨论】:

    标签: c# .net azure-pipelines


    【解决方案1】:

    在我看来,您的“RuntimeIdentifiers”行中有错字 - 它应该包含“win7-x64”,而您有“win-x64”(请注意缺少的 7)。我看到您尝试了“win7-64”路径以及其他一些路径,我想知道您尝试 winy7-64 的时间是否真的正确地通过了这部分并炸毁了其他东西,也许您误读了茶叶?

    我今天遇到了这个问题(在纯 64 位应用程序上),我的解决方法是将此行添加到我的所有 csproj 文件中:

    <RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
    

    你也可能错过了:

    <TargetFramework>net48</TargetFramework>
    

    我的奥德赛还包括必须根除我的解决方案和项目中的所有“AnyCPU”配置项(使用文本编辑器),因为解决方案文件中该配置的存在似乎覆盖了我传递给构建任务。

    我在网上看到其他帖子让人怀疑您可能正在使用旧的 NuGet 还原任务,但这不适用于我的情况。

    我确定您已经找到了解决方法,但也许此错误消息的下一个受害者会发现这很有帮助...

    【讨论】:

      猜你喜欢
      • 2022-06-14
      • 1970-01-01
      • 1970-01-01
      • 2021-01-09
      • 2022-09-29
      • 2012-11-18
      • 2020-03-09
      • 1970-01-01
      • 2021-03-06
      相关资源
      最近更新 更多