2

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

Josh Gust
  • 4,102
  • 25
  • 41
  • Have you tried specify the one project file instead of wildcard in the path to csproj or nuspec, like `src\Libraries\xxx.Abrams.common\xxx.Abrams.common.csproj`? I have create d a simple sample but not reproduce this issue, and you can also try to create a new project to test it. – Leo Liu Oct 16 '18 at 07:45
  • I appreciate the suggestion. Looking at [this question](https://stackoverflow.com/questions/51045543/tfs-automatic-build-nuget-pack-fail-with-code1) it seems like this particular part of my struggle is due to not having a value in my configuration variable. – Josh Gust Oct 16 '18 at 15:18
  • 1
    I'm now having an issue with packing a project that has a reference to a different (read: third party) package. All other projects seem to get packed fine, but this one using a package says that the package can't be found. Isn't this supposed to be handled as a dependency? – Josh Gust Oct 16 '18 at 16:17
  • 1
    Thanks for your reply. It seems you have resolved this issue? If yes, could please share your solution as answer? This can be beneficial to other community members reading this thread and we could close this thread. And now your question is some one using a package says that the package can't be found? Yes, the third party package should be handled as a dependency, you may need download the pack package to check if it handled as a dependency, and check if this dependency package is restored? – Leo Liu Oct 17 '18 at 06:35

1 Answers1

1

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.

Josh Gust
  • 4,102
  • 25
  • 41
  • Could you show the details of the top task where you are adding the reference to the Nuget Package in the pipeline? – runninggeek Jul 26 '19 at 13:41