Dependencies not getting added when Nuget package deployed through Azure Devops Dependencies not getting added when Nuget package deployed through Azure Devops azure azure

Dependencies not getting added when Nuget package deployed through Azure Devops


It could be clearer (in fact, I just created a PR to do so), but hidden at the end of the comment in the YAML snippet for the docs on the Azure DevOps NuGet Task it says:

Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.

Looking at nuget'exe pack docs, it says:

Use dotnet pack or msbuild -t:pack for PackageReference based projects.

So basically, nuget.exe pack doesn't support PackageReference, and all .NET Core projects are PackageReference. So, you shouldn't use the NuGet task in Azure DevOps to pack PackageReference projects, either use the .NET Core task (which uses the dotnet cli), or MSBuild with the -t:pack argument.