【问题标题】:Build of dnx451 on VSTS is unable to resolve dependencies在 VSTS 上构建 dnx451 无法解决依赖关系
【发布时间】:2015-12-23 08:16:20
【问题描述】:

尝试使用 dnx451 作为框架构建 .xproj 在本地可以正常工作,但在 Visual Studio 在线版本上却不行。

日志:

Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16231
Building DnxLibTests for DNX,Version=v4.5.1
Using Project dependency DnxLibTests 1.0.0
Source: C:\a\1\s\DnxLibTests\project.json
Unable to resolve dependency Microsoft.Dnx.Compilation.Abstractions 1.0.0-rc1-final

项目.json

{
  "version": "1.0.0-*",
  "description": "DnxLibTests Class Library",
  "authors": [ "" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "xunit": "2.1.0",
    "xunit.runner.dnx": "2.1.0-rc1-build204"
  },
  "commands": {
    "test": "xunit.runner.dnx"
  },
  "frameworks": {
    "dnx451": { }
  }
}

【问题讨论】:

    标签: asp.net-core azure-devops


    【解决方案1】:

    您的项目的包在构建之前没有恢复。要解决此问题,请添加以下步骤以在构建过程中运行 dnu 恢复:

    1. 使用以下代码创建 PowerShell 脚本:

    Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-对象 { & dnu restore $_.FullName 2>1 }

    1. 将 PowerShell 脚本添加到您的 VSO 存储库。
    2. 在构建定义的顶部添加一个 PowerShell 步骤,然后选择在步骤 1 中创建的脚本。

    保存定义并排队一个新的构建,构建应该成功完成。

    【讨论】:

    • 你让我找到了正确的方向,我实际上已经在使用 PreBuild.ps1 脚本,但没有检查恢复命令的路径,因为它是类库中的恢复,而不是它工作的 asp.net 的 src。这是 PreBuild.ps1 msdn.microsoft.com/en-us/Library/vs/alm/Build/azure/… 的 [链接]
    猜你喜欢
    • 2010-12-14
    • 2016-02-16
    • 2017-02-20
    • 2019-11-11
    • 1970-01-01
    相关资源
    最近更新 更多