NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):
NuGet version (x.x.x.xxx): Nuget 5.8.0.6930
Worked before? If so, with which NuGet version: 5.7
Create a .net .vcsproj project that supports multiple .net framework versions
Try to have the project build on Azure Devops with the latest version of Nuget
The build will fail with the error:
`
`
...
On this past Monday 09/11/2020 all our builds on Azure Devops started failing.
The error message we did get was
The version of nuget used by Azure was: NuGet version 5.8.0.6930
* After forcing the build script to use Nuget 5.7 the problems did disappear. *
It looks that the latest nuget version has problems with projects that support multiple .net framework versions
At first I did create a report against Azure pipelines, but was told to report it here.
https://github.com/microsoft/azure-pipelines-tasks/issues/13887
Please include verbose logs (NuGet.exe
To reproduce, probably it is enough to add the following code to your project:
<PropertyGroup>
<TargetFrameworks>net472;net48</TargetFrameworks>
</PropertyGroup>
Hey @sylvesp
Can you post the contents of your project file/repro project?
I'm not familiar with vcsproj.
Using a regular SDK based csproj, I am not able to repro this when using nuget.exe 5.8.0
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net48</TargetFrameworks>
<RootNamespace>_10289</RootNamespace>
</PropertyGroup>
</Project>
I have the same problem:
The nuget command failed with exit code(1) and error(Invalid restore input. Duplicate frameworks found: 'net462, net5.0, net5.0, netstandard2.0, uap10.0.16299'.
With attached project (when referenced by another .NET 5.0 one).
HaSaM.Configurations.csproj.zip
@rolfik
That's likely because of the MSBuild.SDk.Extras usage.
NuGet reads TargetFrameworkMoniker and TargetPlatformMoniker and it's likely that extras might not be setting them.
However, I can't repro your problem. What's the version of the Sdk that you are using?
The csproj example doesn't have the version and it's likely declared in a global.json.
@nkolev92
I use current version of MSBuildSdkExtras built locally and packed into nuget.
I see. There's 2 ways we can confirm what you are seeing.

Actually I can build the project with Visual Studio 16.8.1 well, but when building it in Azure Pipeline nuget.exe restore command just failed with the error mentioned. The pipeline runs on the same computer as the working Visual Studio.
I cannot find how to specify /bl binary log swith with nuget.exe (5.8).
But after more investigations, I have found there was a mismatch in .global.json files specifying newest MSBuildSdkExtras in nested git submodules. After clearing it and ensuring all specify the latest version, the pipeline build now works for me.
Glad you were able to resolve your problem.
For future reference, nuget.exe binlogs are a little bit trickier than dotnet.exe, msbuild.exe restore.
You'd need to set an env var, https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-environment-variables, NUGET_RESTORE_MSBUILD_ARGS.
Out of curiosity, any particular reason you are using nuget.exe for restore?
Out of curiosity, any particular reason you are using
nuget.exefor restore?
Nothing special. It comes from default Azure pipeline for build with Visual Studio.
We owe the community some more guidance on this, but I'd recommend using msbuild /t:restore wherever possible.
It guarantees you are using the restore tooling perfectly matched to the build tooling. For example, that's how we build our own repo.
At this point, msbuild /t:restore has equivalent capabilities to nuget.exe restore.
@nkolev92 is this something we can wrap up, or should we create new issues for other stuff?
No response from the OP yet, so I'm gonna close this for now.
Happy to re-open if/when we get more details.
Most helpful comment
We owe the community some more guidance on this, but I'd recommend using
msbuild /t:restorewherever possible.It guarantees you are using the restore tooling perfectly matched to the build tooling. For example, that's how we build our own repo.
At this point,
msbuild /t:restorehas equivalent capabilities tonuget.exe restore.