How can I create placeholders in NuSpec file and replace them using TeamCity options

I'm trying to create PlaceHolders in Nuspec and replace them with TeamCity parameters, but teamcity doesn't recognize them. Here is my NuSpec file 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. City command crashes during build, so I cannot recognize these values.

I tried changing @ to $ but no luck.

+3


source to share


1 answer


Some replacement tokens in the NuSpec file are pulled from the assembly when it is packaged.

To add additional token values, you can use a switch -Properties

, but you must use the $ token $ syntax in your NuSpec file, not @token @

eg.

nuget pack -Properties "Environment=DEV;Something=Else"

      

More details can be found here - NuSpec Documentation



Hope it helps

UPDATE

If you add NuGet Pack build step and as advanced options you will need to enter an input field to enter properties in TeamCity

enter image description here

Or you can use the command line parameters box and enter them there using the syntax -Properties "Environment=DEV;Something=Else"

+11


source







All Articles