Azure-pipelines-tasks: Nuget restore fails on net461 project referencing netstandard2.0 project

Created on 30 Aug 2017  路  3Comments  路  Source: microsoft/azure-pipelines-tasks

Similar to https://github.com/Microsoft/vsts-tasks/issues/5047 and workaround https://github.com/Microsoft/vsts-tasks/issues/5065#issuecomment-324486955 solves it.

  1. Create solution
  2. Create netstandard2.0 library (A)
  3. Create net461 library (B)
  4. Reference (B) in (A)
  5. Try NuGet restore task on solution
2017-08-30T13:53:29.4964698Z Errors in d:\a\1\s\test\MyLib.UnitTests\MyLib.UnitTests.csproj
2017-08-30T13:53:29.4964698Z     Project MyLib is not compatible with net461 (.NETFramework,Version=v4.6.1). Project MyLib supports: netstandard2.0 (.NETStandard,Version=v2.0)
2017-08-30T13:53:29.4964698Z     One or more projects are incompatible with .NETFramework,Version=v4.6.1.

Seems this task is using Nuget 4.0.0. This works with Nuget 4.3.0 (as in workaround above)

Potentially related: https://github.com/NuGet/Home/issues/5325, https://github.com/Microsoft/vsts-tasks/issues/5065

Most helpful comment

@grantwar,
We recommend you use the Nuget tool installer to control the version of nuget used by all of your build steps. Placing, the tool installer at the top of your build task will affect subsequent invocations of nuget because the tool installer will fetch the version you indicated an place it at the head of $PATH.
Keith

All 3 comments

@Mardoxx Thanks for posting the workaround to this, much obliged.
VSTS team, when can we expect a bump to the nuget task to use >=4.3 of nuget?

@grantwar,
We recommend you use the Nuget tool installer to control the version of nuget used by all of your build steps. Placing, the tool installer at the top of your build task will affect subsequent invocations of nuget because the tool installer will fetch the version you indicated an place it at the head of $PATH.
Keith

Similar to #5047 and workaround #5065 (comment) solves it.

  1. Create solution
  2. Create netstandard2.0 library (A)
  3. Create net461 library (B)
  4. Reference (B) in (A)
  5. Try NuGet restore task on solution
2017-08-30T13:53:29.4964698Z Errors in d:\a\1\s\test\MyLib.UnitTests\MyLib.UnitTests.csproj
2017-08-30T13:53:29.4964698Z     Project MyLib is not compatible with net461 (.NETFramework,Version=v4.6.1). Project MyLib supports: netstandard2.0 (.NETStandard,Version=v2.0)
2017-08-30T13:53:29.4964698Z     One or more projects are incompatible with .NETFramework,Version=v4.6.1.

Seems this task is using Nuget 4.0.0. This works with Nuget 4.3.0 (as in workaround above)

Potentially related: NuGet/Home#5325, #5065

Update your NuGet installer to version 2.*. After that NuGet.exe will auto-update to version 4.3

Was this page helpful?
0 / 5 - 0 ratings