Creating NuGet Packages from TeamCity as .nupkg


I have exactly the same issue as mentioned here. @Shannon_Lewis almost answers it, but reverts to what I, like the OP has found, in that it works with .ZIP, but not .nupkg.

Using octo.exe from PowerShell, I can generate the nupkg file:

&C:\octo\octo.exe pack --id="MyModule" --version="1.0.0" --basePath=$module --outFolder="C:\Temp" 

However, TeamCity is asking for a source and destination in the “Package Paths” text area. TC runner looks like:

+:/Modules/MyModule/** => TargetLocation/MyModule.%build.number%.nupkg

Any ideas on what I am doing wrong?




In the Push packages step, the Package Paths text area utilizes some out of the box functionality with TeamCity. It uses an ArtifactsPreprocessor when analyzing each line you enter and if it sees a => with a Zip extension on the right hand side it knows how to zip the files from the left into a Zip file. It doesn’t understand anything about nupkg (even though it’s really a Zip file anyway).

In the 4.38.0 version of the TeamCity extension there is a new step to explicitly do a Pack, which uses octo.exe under the hood exactly like the PowerShell you used.

I did a blog post related to this which may be useful. The app being built was .NET Core, but the illustration for using the TeamCity steps should help whether you’re doing .NET Core or full framework. Things of note in there are that the Pack step has first class support for Zip or NuPkg (based on the dropdown selection), and the Push step works with .nupkg because it isn’t using the => processing, it just uses the exact file you specify.

Hope that helps


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.