Skip to content

Instantly share code, notes, and snippets.

@bertt
Last active August 10, 2023 13:36
Show Gist options
  • 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