RSCG – Credfeto.Version.Information.Generator
 
 
| name | Credfeto.Version.Information.Generator | 
| nuget | https://www.nuget.org/packages/Credfeto.Version.Information.Generator/ | 
| link | https://github.com/credfeto/credfeto-version-constants-generator | 
| author | Mark Ridgwell | 
Embedding build information as compile time constants in C# projects.
This is how you can use Credfeto.Version.Information.Generator .
The code that you start with is
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net9.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <PropertyGroup> <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath> </PropertyGroup> <PropertyGroup> <!-- this is the code to start RSCG --> <Version>2024.11.15.450</Version> <Company>AOM</Company> <Copyright>MIT</Copyright> <Product>Info Test</Product> </PropertyGroup> <ItemGroup> <PackageReference Include="Credfeto.Version.Information.Generator" Version="1.0.2.16" PrivateAssets="All" ExcludeAssets="runtime"/> </ItemGroup> </Project>
The code that you will use is
Console.WriteLine(Info.VersionInformation.Version); Console.WriteLine(Info.VersionInformation.Product);
The code that is generated is
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version: Current
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.CodeDom.Compiler;
namespace Info;
[GeneratedCode(tool: "Credfeto.Version.Information.Generator",version: "1.0.2.16")]
internal static class VersionInformation
{
    public const string Version = "2024.11.15.450";
    public const string Product = "Info";
    public const string Company = "AOM";
    public const string Copyright = "MIT";
}
Code and pdf at
https://ignatandrei.github.io/RSCG_Examples/v2/docs/Credfeto.Version.Information.Generator
Leave a Reply