OctoPack in TeamCity

Hi,

I’m trying to build a .nuget using TeamCity and OctoPack and a .nuspec with a variable, but I’m getting an error:

[CreateOctoPackPackage] error OCTONUGET: The replacement token ‘Configuration’ has no value.
[16:39:31][CreateOctoPackPackage] error OCT-1676060969: There was an error calling NuGet. Please see the output above for more details.
Command line: ‘C:…\packages\OctoPack.3.0.45\tools\NuGet.exe’ pack “C:…\TaskProcessor.Deployment\obj\octopacking\TaskProcessor.Deployment.nuspec” -NoPackageAnalysis -BasePath “C:…\TaskProcessor.Deployment” -OutputDirectory “C:…\TaskProcessor.Deployment\obj\octopacked” -Version 1.0.3.1944
[16:39:31]
[CreateOctoPackPackage] error OCT-1676060969: System.Exception: There was an error calling NuGet. Please see the output above for more details.
Command line: ‘C:…\packages\OctoPack.3.0.45\tools\NuGet.exe’ pack “C:…\TaskProcessor.Deployment\obj\octopacking\TaskProcessor.Deployment.nuspec” -NoPackageAnalysis -BasePath “C:…\TaskProcessor.Deployment” -OutputDirectory “C:…\TaskProcessor.Deployment\obj\octopacked” -Version 1.0.3.1944
at OctoPack.Tasks.CreateOctoPackPackage.RunNuGet(String specFilePath, String octopacking, String octopacked, String projectDirectory) in y:\work\1f6ae101e1fcba62\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 551
at OctoPack.Tasks.CreateOctoPackPackage.Execute() in y:\work\1f6ae101e1fcba62\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 188

In the build step, the command line parameter is:
/p:OctoPackNuGetProperties=Configuration=%system.Configuration%
where %system.Configuration% is defined and equals “Release”

And the .nuspec looks like this:

When I’m running the build from command line with: msbuild /t:Rebuild /p:Configuration=Release /p:RunOctoPack=true /p:OctoPackNuGetProperties="Configuration=Release"
it works just fine

I’m running OD version 3.2.8.

Any ideas why the property is not passed to OctoPack and further to NuGet?

HI,

Thanks for reaching out. The 2 things I would check here are:

  • Make sure that %System.Configuration% actually holds a value at build time. A good way to double check this would be to add a Powershell script step that simply prints the value of that TeamCity variable on the screen.

  • Double check the double quotes usage on the msbuild parameters by comparing them to the example shown on the “Replacement tokens” section in our documentation http://docs.octopusdeploy.com/display/OD/Using+OctoPack . Something tells me this will fix your error.

Let me know how it goes

Dalmiro

Hi,
I discovered the actual problem.
The project that was failing was part of a .sln that was built in the first step.
And because it was built at the wrong step, the %system.Configuration% wasn’t yet set.

So now I changed the first step to build just a .csproj, with the dependencies being correctly resolved.
And all steps and packages are correctly built.