次の方法で共有


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; https://github.com/dotnet/cli/issues/3199 and https://github.com/aspnet/Tooling/issues/741.

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) NuGetDownload
  • Then add a standard Nuget restore task but pointed explicitly at the NuGet.exe file that was just downloaded. $(Build.ArtifactStagingDirectory)\Nuget.exe

NugetRestore

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

Comments

  • Anonymous
    March 08, 2017
    Hi..Please help me out.. after settings the above step what was your next Task pipeline..Did you use VSTS or dotnet publish?