Josh Gust
Josh Gust

Reputation: 4445

Why is my project not getting packed with Azure Devops Nuget Pack Task

As you can see below, I am able to pack the .csproj file from the command line on my machine.

enter image description here

But when I try to do it in Azure Devops with this configuration:

enter image description here

My build fails to pack the project.

enter image description here

None of my searching has provided information about what in my project is dependent on System.ValueTuple.4.4.0.nupkg.

For completeness, here is the project in solution explorer of VS 2017.

enter image description here

Upvotes: 2

Views: 1977

Answers (1)

Josh Gust
Josh Gust

Reputation: 4445

The NuGet Pack task was having issues packing projects because I didn't explicitly set the value of the $(BuildConfiguration) variable on my pipeline.

The secondary issue with the task not bringing in dependencies correctly is a known issue with nuget.exe which was mitigated by using the MSBuild task with the /t:Pack option.

My pipeline task for building now looks like this:

MSBuild -t:Pack

Make sure to take note of the parameters given to MSBuild for targeting Pack.

For .Net Framework, also take note of the Powershell task adding package references to the NuGet.Build.Tasks.Pack package, which adds Pack as a target for MSBuild. I added this powershell task to the build so that devs don't need to add the package explicitly to new projects in this solution.

Upvotes: 1

Related Questions