AssemblyMetadata.Generators

RSCG – AssemblyMetadata.Generators    

name AssemblyMetadata.Generators
nuget https://www.nuget.org/packages/AssemblyMetadata.Generators/
link https://github.com/loresoft/AssemblyMetadata.Generators
author LoreSoft

Generating assembly metadata attributes at compile time.

  

This is how you can use AssemblyMetadata.Generators .

The code that you start with is


<project sdk="Microsoft.NET.Sdk">

  <propertygroup>
    <outputtype>Exe</outputtype>
    <targetframework>net10.0</targetframework>
    <implicitusings>enable</implicitusings>
    <nullable>enable</nullable>
  </propertygroup>

  <itemgroup>
    <packagereference version="2.2.0" include="AssemblyMetadata.Generators" referenceoutputassembly="false" outputitemtype="Analyzer">
  </packagereference>
	<propertygroup>
		<emitcompilergeneratedfiles>true</emitcompilergeneratedfiles>
		<compilergeneratedfilesoutputpath>$(BaseIntermediateOutputPath)\GX</compilergeneratedfilesoutputpath>
	</propertygroup>
</itemgroup>


The code that you will use is


Console.WriteLine(ThisAssembly.Title);

Console.WriteLine(ThisAssembly.TargetFramework);


   The code that is generated is

// <auto-generated>

/// <summary>
/// Assembly attributes exposed as public constants
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("AssemblyMetadata.Generators", "2.2.0+ec398d1ec2fd415d5475a08ad0fada879c510c97")]
internal static partial class ThisAssembly
{

    public const string TargetFramework = ".NETCoreApp,Version=v10.0";

    public const string Company = "DemoMeta";

    public const string Configuration = "Debug";

    public const string FileVersion = "1.0.0.0";

    public const string InformationalVersion = "1.0.0+3eed64e7dd376ed8c6cf1f77efd5968cb88c898a";

    public const string Product = "DemoMeta";

    public const string Title = "DemoMeta";

    public const string Version = "1.0.0.0";

    public const string AssemblyName = "DemoMeta";

    public const string DefineConstants = "TRACE";

    public const string RootNamespace = "DemoMeta";

    public const string PackageVersion = "1.0.0";

    public const string PackageId = "DemoMeta";

}

Code and pdf at

https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators


Posted

in

,

by

Tags: