I am trying to create PlaceHolders in Nuspec and Replace them via TeamCity parameters, but teamcity does not recognise them. Here is my NuSpec files Metadata
<metadata>
<id>Id.@environment@</id>
<title>Title.@environment@</title>
<version>1.0.0</version>
<authors>Charles Taylor</authors>
<owners>Charles Taylor</owners>
<licenseUrl>http://www.ctcplc.com</licenseUrl>
<projectUrl>http://www.ctcplc.com</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Currency Request</description>
<releaseNotes></releaseNotes>
</metadata>
I have an environment variable in TeamCity. Team City crashes during build that i can't recognise these values.
I have tried changing @ to $, but no luck.
A NUSpec file contains package metadata and is used to create a package. A package is created from your project, which is why it would make sense to place the NUSpec file in the project folder.
Some replacement tokens in a NuSpec file are pulled from the assembly at the point of packaging it.
In order to provide additional token values to be substituted, you can use the -Properties
switch, but you must be using the $token$ syntax in your NuSpec file, and not @token@
e.g.
nuget pack -Properties "Environment=DEV;Something=Else"
More details can be found here - NuSpec documentation
Hope this helps
UPDATE
If you add a NuGet Pack build step and how the advanced options, you should be presented with an input field to enter the properties in TeamCity
Or you can make use of the command line parameters field and enter them there in using the syntax -Properties "Environment=DEV;Something=Else"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With