Nuget Package Id

Hi,

I have used the following guide to connect TeamCity with OctopusDeploy and it works fine.

My problem is that I wan’t to be able to set the Nuget Package Id by myself. Under “Octopus Packaging” in TeamCity i don’t have this option.

The reason is that I have multiple branches of the same project, and now all get the same Nuget Package Id name since it only using the project name. I would like to add branch name as part of the Nuget Package Id name, for example “MyProject_Test”, “MyProject_Prod”.

How do i solve this?

Hi Patric,

Thanks for getting in touch! In TeamCity you can create system parameters that will allow you to define the branch name, you can then use this within your TC/Octopus addon using the OctoPack OctoPackAppendToPackageId option.
Octopack documentation that explains this option. http://docs.octopusdeploy.com/display/OD/Using+OctoPack

Hope that helps!
Vanessa

Using OctoPackAppendToPackageId might be fine for some cases, but in my case I want to prepend the package id with something (eg company name). Preferrably, I want to be able to control the Id myself entirely. I know this can be done using a custom NuSpec-file, but then (atleast afaik) I have to specify values for the version/title etc. Here. I would like to have the normal/default OctoPack behavior (automatically generated version using assemblyversion. Custom NuSpecfile seems like a lot of hassle just to control the Package ID. I know I can change the name of the project in My solution but in my case, thats not entirely possible. Is there some other way yo control the PackageId that I’ve missed?

Version number control is easy with the nuspec files, just set the version to “$version” and it get automatically populated by OctoPack. Other replacement tokens work as well.

Nuspec sounds like the easiest way to me.

Hi Emil,

Sam is correct - replacement tokens are the way to go, so you shouldn’t need to change these every time. A great place to start is the NuGet spec command. It should do a lot of the work for you.

OctoPack is provided mainly as a tool of convenience for default behaviour; which includes taking the name of the project file as the NuGet package name. Incidentally, NuGet itself does this when you call nuget.exe pack without a nuspec file, so we’re not doing anything special with the package metadata here. If you need to create a NuGet package that varies from what OctoPack provides, you’ll need to provide a nuspec.

Thanks,
Damo