Last active
August 10, 2023 13:36
-
-
Save bertt/b54f023dc927d22806f2d9ad8aef11aa to your computer and use it in GitHub Desktop.
dotnet tagged version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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