PowerShell/PowerShellStandard

Document minimum required version of nuget.exe for published NuGet packages (it does not work with nuget 4.1)

bergmeister opened this issue · 0 comments

Observed in a VSTS environment but I think it applies to nuget.exe in general:

Using the NuGetCommand@2 task, nuget.exe of version 4.1.0 is being used (locally installed version).
When referencing one of the PSStandard Nuget packages, it gives a red herring error that PSStandard is not compatible with net472:

The nuget command failed with exit code(1) and error(Errors in D:\_Builds\E20-IX-VSBD012P.02\7\s\Src\FancyPants.csproj
    Package PowerShellStandard.Library 3.0.0-preview-02 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package PowerShellStandard.Library 3.0.0-preview-02 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    One or more packages are incompatible with .NETFramework,Version=v4.7.2.

The actual problem is that a newer version of nuget.exe is needed (it works with nuget.exe v 4.7), which can be solved by adding for example this step into a VSTS build

  - task: NuGetToolInstaller@0
    displayName: Use NuGet 4.x
    inputs:
      versionSpec: 4.x
      checkLatest: true