Skip to content

credfeto/credfeto-version-constants-generator

Repository files navigation

credfeto-version-constants-generator

Source generator for embedding build information as compile time constants in C# projects.

Usage

Add the following to your project file:

<ItemGroup>
    <PackageReference Include="Credfeto.Version.Information.Generator" Version="1.0.2.16" PrivateAssets="All"
                      ExcludeAssets="runtime"/>
</ItemGroup>

This generates a class called VersionInformation in the root namespace of the project with the following properties taken from properties in the project file:

internal static class VersionInformation
{
    public const string Version = "0.0.0.1-test";
    public const string Product = "Credfeto.Version.Information.Example.Tests";
    public const string Company = "Example Company";
    public const string Copyright = "Copyright © Example Company 2024";
}

Controlled by the following properties:

<PropertyGroup>
    <Company>Example Company</Company>
    <Copyright>Copyright © Example Company 2024</Copyright>
</PropertyGroup>
  • Version comes from the AssemblyInformationalVersion that can be set using the /p:Version=0.0.1-test command line argument to MSBuild. or a <Version> property in the project file.
  • Product comes from the Root Namespace property for the assembly.

Build Status

Branch Status
main Build: Pre-Release
release Build: Release

Changelog

View changelog

Contributors

About

Simple version information constants generator

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 2

  •  
  •  

Languages