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).