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.
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 https://dist.nuget.org/win-x86-commandline/v3.5.0-rc1/NuGet.exe
- Add a simple PowerShell task to download the Release Candidate nuget. The command should be: –Invoke-WebRequest -OutFile “$(build.ArtfifactStagingDirectory)\NuGet.exe” $(NugetDownloadUrl)
- 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.