0
votes

I cannot seem to figure out what is causing this issue in Azure DevOps. I have three separate projects each configured to do a nuget push action when I consider them a release build by creating the release branch. CI/CD kicks in and automatically creates/updates the package. This works fine on two of the three NuGet packages. However, I cannot get the third package to read the details in the csproj. I even copied the build pipeline from the two working examples and verified that the published artifacts show the nuspec file is not what I specify in the csproj.

You can see I last pushed the two working examples September 19th with valid descriptions. However, the third one is not getting a valid description (even though its set in the csproj) like the other two are. The pipelines are exactly the same, has this been updated recently to require additional configuration to read the contents of the csproj file?

Performing a build locally outside of Azure DevOps and using the option "Generate NuGet package on build" produces a nuspec file I want. I am not sure why Azure DevOps is not working for this single project.

enter image description here

2

2 Answers

2
votes

I am not sure if this is a bug with NuGet for .NET Standard 2.1 or if something else is wrong.

It's just Nuget.exe can support .NET Standard 2.1 very well. I can reproduce same behavior on my side.

Nuget pack .net standard 2.0:

enter image description here

Then I changed the target framework from 2.0 to 2.1 and rebuild the project, the Warning NU5115 that Description/Author is not specified appeared.

Nuget pack .net standard 2.1:

enter image description here

Solution:

Use the dotnet pack command instead.

Both Create and publish .NET standard package locally and Azure Devops Nuget task recommend using .NET Core CLI task with dotnet pack command for SDK-style projects like .Net Standard and .Net Core.

enter image description here

Note from Nuget task.

enter image description here

So consider using Use .net core task with dotnet pack command, it works well to read the project file.

0
votes

Not sure what the root cause is, but this third project is .NET Standard 2.1 where the others are .NET Standard 2.0. Apparently this causes NuGet Pack to fail. However, as a workaround I was able to use the option "Generate NuGet Package on build" and this worked fine. In a release pipeline, I used that version instead of a NuGet Pack version. Description, author, and other important information I want is now included.

I am not sure if this is a bug with NuGet for .NET Standard 2.1 or if something else is wrong. If you run into this option, use the "Generate NuGet Package on build" and then in your release pipeline, browse to that .nupkg file and replace with asterisk so it will deploy for future versions.