dotnet restore unable to resolve .NET Framework libraries

I was at a hack at the start of the month and we were attempting to create a CI pipeline for the solution. The solution was made up of a dotnet core (1.0.0-preview2-003121) Web API project that references some .Net Framework 4.5.2 class libraries. When I compiled this in VSTS it was unable to restore the .Net Framework libraries.

Searching around, there are similar issues being found on GitHub; and

The problem turned out that the version of Nuget on the Hosted Build Agents does not work with this mix of core and framework. In order to fix this: -

  • Add a variable called NugetDownloadUrl with a value of
  • Add a simple PowerShell task to download the Release Candidate nuget. The command should be: -Invoke-WebRequest -OutFile "$(build.ArtfifactStagingDirectory)\NuGet.exe" $(NugetDownloadUrl) NuGetDownload
  • Then add a standard Nuget restore task but pointed explicitly at the NuGet.exe file that was just downloaded. $(Build.ArtifactStagingDirectory)\Nuget.exe


Now, when you compile your project, it will compile your dotnet framework projects and restore the dotnet core packages.