How to get <Version> from .csproj into artifact zipfile's name

T Dahl

20 Apr, 2019 08:38 PM

For a .Net Core 3 C# project I have successfully set up a build process with artifact upload via SFTP.
How can I include the <Version> statement in the .csproj file as a part of the zipfile's name that is uploaded? E.g. "mybuild-v1.0.0.0.zip"
I know I can specify for example (under Artifacts):
Path: consoleapp1\bin\debug\netcoreapp3.0
Name: files%APPVEYOR_BUILD_VERSION%
But this is Appveyor's version, and not the project version itself.
Is the solution to write a script that manually extracts the <Version> value from the xml file into an environment variable and then refer to that? Or is it a built in appveyor way?