RSCG – BuildInfo

RSCG – BuildInfo
 
 

name BuildInfo
nuget https://www.nuget.org/packages/BuildInfo/
link https://github.com/linkdotnet/BuildInformation
author Steven Giesel

Generating build information

 

This is how you can use BuildInfo .

The code that you start with is


<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<OutputType>Exe</OutputType>
		<TargetFramework>netcoreapp7.0</TargetFramework>
	</PropertyGroup>
	<PropertyGroup>
		<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
		<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
	</PropertyGroup>
	<PropertyGroup>
		<UseRootNamespaceForBuildInformation>true</UseRootNamespaceForBuildInformation>
	</PropertyGroup>

	<ItemGroup>
		<CompilerVisibleProperty Include="UseRootNamespaceForBuildInformation" />
	</ItemGroup>

	<ItemGroup>
	  <PackageReference Include="LinkDotNet.BuildInformation" Version="1.0.0" />
		
	</ItemGroup>
	<PropertyGroup>
		<Version>2024.01.20</Version>
	</PropertyGroup>
</Project>


The code that you will use is


var strVersion = RSCG_Version.BuildInformation.AssemblyVersion;
System.Console.WriteLine(strVersion);


 

The code that is generated is

// <auto-generated>
// This file was generated by the LinkDotNet.BuildInformation package.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>

using System;
using System.Globalization;

namespace RSCG_Version;

internal static class BuildInformation
{
    /// <summary>
    /// Returns the build date (UTC).
    /// </summary>
    /// <remarks>Value is: 2024-01-21T07:37:28.4648410Z</remarks>
    public static readonly DateTime BuildAt = DateTime.ParseExact("2024-01-21T07:37:28.4648410Z", "O", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);

    /// <summary>
    /// Returns the platform.
    /// </summary>
    /// <remarks>Value is: AnyCpu</remarks>
    public const string Platform = "AnyCpu";

    /// <summary>
    /// Returns the warning level.
    /// </summary>
    /// <remarks>Value is: 7</remarks>
    public const int WarningLevel = 7;

    /// <summary>
    /// Returns the configuration.
    /// </summary>
    /// <remarks>Value is: Release</remarks>
    public const string Configuration = "Release";

    /// <summary>
    /// Returns the assembly version.
    /// </summary>
    /// <remarks>Value is: 2024.1.20.0</remarks>
    public const string AssemblyVersion = "2024.1.20.0";

    /// <summary>
    /// Returns the assembly file version.
    /// </summary>
    /// <remarks>Value is: 2024.1.20.0</remarks>
    public const string AssemblyFileVersion = "2024.1.20.0";

    /// <summary>
    /// Returns the assembly name.
    /// </summary>
    /// <remarks>Value is: RSCG_Version</remarks>
    public const string AssemblyName = "RSCG_Version";

    /// <summary>
    /// Returns the target framework moniker.
    /// </summary>
    /// <remarks>Value is: netcoreapp7.0</remarks>
    public const string TargetFrameworkMoniker = "netcoreapp7.0";

    /// <summary>
    /// Returns the nullability level.
    /// </summary>
    /// <remarks>Value is: Disable</remarks>
    public const string Nullability = "Disable";

    /// <summary>
    /// Returns whether the build is deterministic.
    /// </summary>
    /// <remarks>Value is: true</remarks>
    public const bool Deterministic = true;
}

Code and pdf at

https://ignatandrei.github.io/RSCG_Examples/v2/docs/BuildInfo