Use environment variable in version
I would like to bump versions only through AssemblyInfo.cs,
therefore I would like to get AssemblyVersion with a PowerShell
script and use it for both build version and NuGet package
version.
Is it possible?
Here is my appveyor.yml:
version: $(PACKAGE_VERSION).{build}
configuration: Release
platform: Any CPU
before_build:
- cmd: nuget restore src/MySolution.sln -DisableParallelProcessing
- ps: .\tools\setPackageVersionEnvVar.ps1 build:
project: src/MySolution.sln verbosity: minimal after_build:
- cmd: nuget pack src/MySolution/MyProject.csproj -Prop
Configuration=Release -Prop Platform=AnyCPU artifacts:
- path: NLog.Targets.Syslog*.nupkg
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ilya Finkelshte... on Jan 18, 2017 @ 05:54 PM
Hi Luigi,
This is possible, however not exactly this way. Please see my notes/comments
Not sure where value of
PACKAGE_VERSION
variable is coming from.In any case
version: $(PACKAGE_VERSION).{build}
will not work, because it is being set before build started andPACKAGE_VERSION
variable at this moment does not even exist. To update build version, please use build worker API. Specifically command likeUpdate-AppveyorBuild -Version "$env:PACKAGE_VERSION.$env.APPVEYOR_BUILD_NUMBER"
should work.To do AssemblyInfo patching you don't have to invent your own script, we have this feature fro you.
Side note: double check that your
AssemblyInfo.cs
containsAssemblyInformationalVersion
tag, otherwise nuget versioning may not work as expected.Thanks!
Ilya.
Ilya Finkelshteyn closed this discussion on Aug 25, 2018 @ 02:14 AM.