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

Podman– Command execution failed with exit code 125

After updating WSL on one of the developer machines, Podman failed to work. When we took a look through Podman Desktop, we noticed that Podman had stopped running and returned the following error message: Error: Command execution failed with exit code 125 Here are the steps we tried to fix the issue: We started by running podman info to get some extra details on what could be wrong: >podman info OS: windows/amd64 provider: wsl version: 5.3.1 Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:2655: connectex: No connection could be made because the target machine actively refused it. That makes sense as the podman VM was not running. Let’s check the VM: >podman machine list NAME         ...

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.

Cache stampede: when our cache turned against us

While investigating some performance issues, we ran into an ASP.NET Core API that cached a fairly expensive aggregation query for 60 seconds. Under normal load, that was fine: one request rebuilds the cache, everyone else reads from it. Under peak load, dozens of requests would arrive in that same expiry window, all see a cache miss, and all fire the same expensive query in parallel. The database didn't like that. That was the moment when our caching layer stopped helping and started hurting. A burst of requests comes in at the same time, all miss the cache, and all go hammer the database or the downstream API at once. That's a cache stampede . The cache was supposed to protect our backend, and for a few hundred milliseconds it did the opposite. Why this happens IMemoryCache.GetOrCreate (and its async sibling) looks like it protects you, but it doesn't add any locking on its own. Look at the naive version: public async Task<Report> GetReportAsync(string key) ...