Skip to content

Instantly share code, notes, and snippets.

@bertt
Last active August 10, 2023 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bertt/b54f023dc927d22806f2d9ad8aef11aa to your computer and use it in GitHub Desktop.
Save bertt/b54f023dc927d22806f2d9ad8aef11aa to your computer and use it in GitHub Desktop.
dotnet tagged version
Tool: dotnetCampus.TagToVersion
https://github.com/dotnet-campus/dotnetCampus.TagToVersion
Writes a tag to file Build/Version.props
<Project>
<PropertyGroup>
<Version>0.11</Version>
</PropertyGroup>
</Project>
Install:
$ dotnet tool install -g dotnetCampus.TagToVersion
Added in Directory.builds.props:
<Project>
<Import Project="Build\Version.props" />
</Project>
Run tool:
$ dotnet TagToVersion -t ${{ github.ref }}
In code retrieve it:
```
var assembly = Assembly.GetExecutingAssembly();
var assemblyVersion = assembly.GetName().Version;
Console.WriteLine($"Version: " + assemblyVersion);
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment