SlusserLabs.AssemblyInfo 1.0.0-ci.18

This is a prerelease version of SlusserLabs.AssemblyInfo.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package SlusserLabs.AssemblyInfo --version 1.0.0-ci.18
                    
NuGet\Install-Package SlusserLabs.AssemblyInfo -Version 1.0.0-ci.18
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SlusserLabs.AssemblyInfo" Version="1.0.0-ci.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SlusserLabs.AssemblyInfo" Version="1.0.0-ci.18" />
                    
Directory.Packages.props
<PackageReference Include="SlusserLabs.AssemblyInfo" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SlusserLabs.AssemblyInfo --version 1.0.0-ci.18
                    
#r "nuget: SlusserLabs.AssemblyInfo, 1.0.0-ci.18"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SlusserLabs.AssemblyInfo@1.0.0-ci.18
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SlusserLabs.AssemblyInfo&version=1.0.0-ci.18&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SlusserLabs.AssemblyInfo&version=1.0.0-ci.18&prerelease
                    
Install as a Cake Tool

AssemblyInfo

AssemblyInfo is a source generator that exposes assembly attributes and custom assembly metadata through generated constants. The values are captured at compile time and require no runtime reflection, making it suitable for AOT.

This project exists to provide access to assembly information without the need for reflection. If your build target supports reflection, you can still use this project but it would be for its convenience only.

Installation

Add the package to the project whose assembly information you want to expose:

dotnet add package SlusserLabs.AssemblyInfo

Usage

Mark a partial class or record as the destination for generated metadata using the GenerateAssemblyInfo attribute:

using SlusserLabs.AssemblyInfo;

[GenerateAssemblyInfo]
public static partial class AssemblyInfo;

The following .csproj project properties are supported as outlined in MSBuild documentation:

<PropertyGroup>
  <Company></Company>
  <Configuration></Configuration>
  <Copyright></Copyright>
  <Description></Description>
  <FileVersion></FileVersion>
  <InformationalVersion></InformationalVersion>
  <Product></Product>
  <AssemblyTitle></AssemblyTitle>
  <AssemblyVersion></AssemblyVersion>
</PropertyGroup>

The result is a generated class with the following public const fields:

public static partial class AssemblyInfo
{
  public const string Company;
  public const string Configuration;
  public const string Copyright;
  public const string Description;
  public const string FileVersion;
  public const string InformationalVersion;
  public const string Product;
  public const string AssemblyTitle;
  public const string AssemblyVersion;
}

That's it!

AssemblyMetadata

Custom AssemblyMetadataAttribute values are also supported and makes it easy to embed arbitrary strings. For example, this project configuration:

<ItemGroup>
  <AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
    <_Parameter1>BuildDate</_Parameter1>
    <_Parameter2>2026-08-17</_Parameter2>
  </AssemblyAttribute>
</ItemGroup>

generates a BuildDate constant.

I would recommend always using key names that are also valid C# identifiers because they will be generated as the name of a const. When a key name is not a valid identifier, the generator will attempt to create a valid C# identifier by replacing unsupported characters.

Advanced Options

The GenerateAssemblyInfo attribute accepts an optional GenerateAssemblyInfoOptions flags enum if you want want more control over which assembly metadata you want included. For example, if you wanted to put assembly attributes in one class and metadata in another to avoid naming collisions, you might do that like this (my usual preference):

using SlusserLabs.AssemblyInfo;

// Contains only title, product, version, etc...
[GenerateAssemblyInfo(GenerateAssemblyInfoOptions.AllAssemblyAttributes)]
public static partial class AssemblyInfo
{
    // Contains only metadata key-value pairs
    [GenerateAssemblyInfo(GenerateAssemblyInfoOptions.AssemblyMetadata)]
    public static partial class Metadata;
}

AI Disclosure

This project was built with the help of Codex 5.6 Sol for code generation. As with any tool I use for coding, I am fully responsible for the end result and only put forward this project with full confidence that I have reviewed every line. Whether a line of code in this project was fully AI generated, AI assisted, or entirely from my own Muppet fingers on the keyboard, it is held to the same expectations.

Acknowledgements

This project is inspired by ThisAssembly. I wholeheartedly recommend that project if it is more to your liking; I just wanted slightly different ergonomics.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-ci.21 2 8/22/2026
1.0.0-ci.18 2 8/22/2026
1.0.0-ci.15 0 8/22/2026
1.0.0-ci.6 1 8/21/2026
1.0.0-ci.4 0 8/21/2026