vernou
vernou

Reputation: 7590

TFS : Add options from expression

In TFS 2018, I use the task build "dotnet pack". To generate a beta, I set the additional build properties to :

PackageVersion=2.0.$(Build.BuildNumber)-beta

To generate a release, I need remove "-beta" :

PackageVersion=2.0.$(Build.BuildNumber)

Is posible to add "-beta" from a expression? Like :

PackageVersion=2.0.$(Build.BuildNumber)$[ $(beta) ? "-beta" : "" ]

*$(beta) is a variable

Upvotes: 1

Views: 37

Answers (2)

vernou
vernou

Reputation: 7590

I set the additional build properties :

PackageVersion=2.0.$(Build.BuildNumber)$(beta)

And the variable $(beta) has the default value "-beta". For build a beta, I don't modify $(beta) variable. Then the package version is "2.0.145-beta".

For build a release, I remove the value in $(beta) variable. Then the package version is "2.0.146".

Upvotes: 0

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51083

No, it's not able to use this kind of expression $[ $(beta) ? "-beta" : "" ].

As a workaround, you could configure your release to unzip package, change the version and zip again.

Upvotes: 1

Related Questions