Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Credfeto.Version.Information.Generator #203

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

credfeto
Copy link
Contributor

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.

@credfeto credfeto requested a review from amis92 as a code owner November 10, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant