MyGet Build Services has built-in support for GitVersion and is encouraging you to leverage GitVersion + GitFlow to produce Semantically Versioned packages.
- Create a custom build script: we advise to run a tool like GitVersion in a pre-build script, so that it can set additional environment variables for the actual build script. MyGet by convention automatically picks up any of the following file names as pre-build script:
GitVersion /output buildserver: this will cause MyGet Build Services to set the current
%PackageVersion%value to the NuGet-compatible SemVer generated by GitVersion and apply this MyGet Environment Variable wherever it is used during the build process.
- Ensure the build script has been pushed to your source repository root. Done :)
Note: If you require the
AssemblyInfo.cs files in your project to be patched with the information from GitVersion, you will have to run it manually, for example using the command:
call %GitVersion% /updateassemblyinfo true.
Also check docs.myget.org for the latest full info.