Skip to main content

Azure DevOps–Build task - NuGet pack issues

Today I had to configure a new build pipeline. One of the steps in this pipeline is the creation of our NuGet packages that our pushed to our internal NuGet store.

Before I always used the (depecrated) NuGet Packager task

As I was in an adventurous mood I decided to switch to the latest version. But no luck for me, my first build failed with the following error message:

2019-01-22T14:48:56.7624685Z ##[section]Starting: NuGet pack

2019-01-22T14:48:56.7644225Z ==============================================================================

2019-01-22T14:48:56.7644225Z Task         : NuGet

2019-01-22T14:48:56.7644225Z Description  : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.

2019-01-22T14:48:56.7644225Z Version      : 2.0.24

2019-01-22T14:48:56.7644225Z Author       : Microsoft Corporation

2019-01-22T14:48:56.7644225Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)

2019-01-22T14:48:56.7644225Z ==============================================================================

2019-01-22T14:48:58.5015285Z Found tool in cache: NuGet 4.1.0 x64

2019-01-22T14:48:58.5044595Z Found tool in cache: NuGet 4.1.0 x64

2019-01-22T14:48:58.5562405Z Resolved from tool cache: 4.1.0

2019-01-22T14:48:58.5562405Z Using version: 4.1.0

2019-01-22T14:48:58.5572175Z Found tool in cache: NuGet 4.1.0 x64

2019-01-22T14:48:58.7428475Z [command]C:\Windows\system32\chcp.com 65001

2019-01-22T14:48:58.7428475Z Active code page: 65001

2019-01-22T14:49:19.3380075Z Attempting to pack file: D:\b\4\agent\_work\34\s\SOFA\NugetSpecs\Company.Library.csproj.nuspec

2019-01-22T14:49:19.3497315Z [command]D:\b\4\agent\_work\_tool\NuGet\4.1.0\x64\nuget.exe pack D:\b\4\agent\_work\34\s\SOFA\NugetSpecs\Company.Library.csproj.nuspec -NonInteractive -OutputDirectory D:\b\4\agent\_work\34\a -Properties "Configuration=release;-BasePath D:\b\4\agent\_work\34\a" -Verbosity Detailed

2019-01-22T14:49:21.3310875Z System.IO.FileNotFoundException: File not found: Company.Library.dll'.

2019-01-22T14:49:21.3310875Z NuGet Version: 4.1.0.2450

2019-01-22T14:49:21.3310875Z Attempting to build package from Company.Library.csproj.nuspec'.

2019-01-22T14:49:21.3320645Z    at NuGet.Packaging.PackageBuilder.AddFiles(String basePath, String source, String destination, String exclude)

2019-01-22T14:49:21.3730985Z ##[error]The nuget command failed with exit code(1) and error(System.IO.FileNotFoundException: File not found: 'Company.Library.dll'.

   at NuGet.Packaging.PackageBuilder.AddFiles(String basePath, String source, String destination, String exclude)

   at NuGet.Packaging.PackageBuilder.PopulateFiles(String basePath, IEnumerable`1 files)

   at NuGet.Packaging.PackageBuilder.ReadManifest(Stream stream, String basePath, Func`2 propertyProvider)

   at NuGet.Packaging.PackageBuilder..ctor(String path, String basePath, Func`2 propertyProvider, Boolean includeEmptyDirectories)

   at NuGet.Commands.PackCommandRunner.CreatePackageBuilderFromNuspec(String path)

   at NuGet.Commands.PackCommandRunner.BuildFromNuspec(String path)

   at NuGet.CommandLine.PackCommand.ExecuteCommand()

   at NuGet.CommandLine.Command.ExecuteCommandAsync()

   at NuGet.CommandLine.Command.Execute()

   at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args))

2019-01-22T14:49:21.3740755Z ##[error]An error ocurred while trying to pack the files.

2019-01-22T14:49:21.3740755Z    at NuGet.Packaging.PackageBuilder.PopulateFiles(String basePath, IEnumerable`1 files)

2019-01-22T14:49:21.3740755Z    at NuGet.Packaging.PackageBuilder.ReadManifest(Stream stream, String basePath, Func`2 propertyProvider)

2019-01-22T14:49:21.3740755Z    at NuGet.Packaging.PackageBuilder..ctor(String path, String basePath, Func`2 propertyProvider, Boolean includeEmptyDirectories)

2019-01-22T14:49:21.3740755Z    at NuGet.Commands.PackCommandRunner.CreatePackageBuilderFromNuspec(String path)

2019-01-22T14:49:21.3740755Z    at NuGet.Commands.PackCommandRunner.BuildFromNuspec(String path)

2019-01-22T14:49:21.3740755Z    at NuGet.CommandLine.PackCommand.ExecuteCommand()

2019-01-22T14:49:21.3740755Z    at NuGet.CommandLine.Command.ExecuteCommandAsync()

2019-01-22T14:49:21.3750525Z    at NuGet.CommandLine.Command.Execute()

2019-01-22T14:49:21.3750525Z    at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)

2019-01-22T14:49:21.5362575Z ##[section]Async Command Start: Telemetry

2019-01-22T14:49:21.5362575Z ##[section]Async Command End: Telemetry

2019-01-22T14:49:21.5362575Z ##[section]Async Command Start: Telemetry

2019-01-22T14:49:21.5362575Z ##[section]Async Command End: Telemetry

2019-01-22T14:49:21.5362575Z ##[section]Finishing: NuGet pack

What is going wrong?

Problem is that the location of my NuGet spec files is not the same as the location of our built libraries. To solve this before I specified a BasePath using the NuGet Arguments field:

Unfortunately the option to specify extra NuGet Arguments seems to be gone in the new(er) NuGet Build task.

Anyone who knows a solution?(At the moment I reverted back to the old deprecated task).

Popular posts from this blog

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.

Kubernetes–Limit your environmental impact

Reducing the carbon footprint and CO2 emission of our (cloud) workloads, is a responsibility of all of us. If you are running a Kubernetes cluster, have a look at Kube-Green . kube-green is a simple Kubernetes operator that automatically shuts down (some of) your pods when you don't need them. A single pod produces about 11 Kg CO2eq per year( here the calculation). Reason enough to give it a try! Installing kube-green in your cluster The easiest way to install the operator in your cluster is through kubectl. We first need to install a cert-manager: kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.5/cert-manager.yaml Remark: Wait a minute before you continue as it can take some time before the cert-manager is up & running inside your cluster. Now we can install the kube-green operator: kubectl apply -f https://github.com/kube-green/kube-green/releases/latest/download/kube-green.yaml Now in the namespace where we want t...

DevToys–A swiss army knife for developers

As a developer there are a lot of small tasks you need to do as part of your coding, debugging and testing activities.  DevToys is an offline windows app that tries to help you with these tasks. Instead of using different websites you get a fully offline experience offering help for a large list of tasks. Many tools are available. Here is the current list: Converters JSON <> YAML Timestamp Number Base Cron Parser Encoders / Decoders HTML URL Base64 Text & Image GZip JWT Decoder Formatters JSON SQL XML Generators Hash (MD5, SHA1, SHA256, SHA512) UUID 1 and 4 Lorem Ipsum Checksum Text Escape / Unescape Inspector & Case Converter Regex Tester Text Comparer XML Validator Markdown Preview Graphic Col...