msr
msr

Reputation: 135

Build of dnx451 on VSTS is unable to resolve dependencies

Trying to build a .xproj with dnx451 as framework works fine locally but not on Visual Studio online builds.

Log:

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

project.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": { }
  }
}

Upvotes: 1

Views: 370

Answers (1)

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29976

The packages of your project were not restored before build. To fix this issue, add following steps to run a dnu restore in your build process:

  1. Create a PowerShell script with following code:

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

  1. Add the PowerShell script to your VSO repository.
  2. Add a PowerShell step in the top of your build definition and select the script created in Step 1. enter image description here

Save the definition and queue a new build, the build should be completed successfully.

Upvotes: 1

Related Questions