NetEscapades.ProjectInfo 0.1.0-beta4

This is a prerelease version of NetEscapades.ProjectInfo.
dotnet add package NetEscapades.ProjectInfo --version 0.1.0-beta4
                    
NuGet\Install-Package NetEscapades.ProjectInfo -Version 0.1.0-beta4
                    
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="NetEscapades.ProjectInfo" Version="0.1.0-beta4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetEscapades.ProjectInfo" Version="0.1.0-beta4" />
                    
Directory.Packages.props
<PackageReference Include="NetEscapades.ProjectInfo" />
                    
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 NetEscapades.ProjectInfo --version 0.1.0-beta4
                    
#r "nuget: NetEscapades.ProjectInfo, 0.1.0-beta4"
                    
#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 NetEscapades.ProjectInfo@0.1.0-beta4
                    
#: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=NetEscapades.ProjectInfo&version=0.1.0-beta4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=NetEscapades.ProjectInfo&version=0.1.0-beta4&prerelease
                    
Install as a Cake Tool

alternate text is missing from this package README image NetEscapades.ProjectInfo

Build status NuGet

NetEscapades.ProjectInfo is a small source generator that echoes values from your project file into a generated ProjectInfo class, as const string values or as ReadOnlySpan<byte> UTF-8 literals.

Adding NetEscapades.ProjectInfo to your project

Add the package to your application using

dotnet add package NetEscapades.ProjectInfo

You can mark the package as PrivateAssets="all", as nothing from it is needed at runtime.

Usage

Declare the values you want in your .csproj file:

<ItemGroup>
  <ProjectInfoString Include="Version" Value="1.2.3" />
  <ProjectInfoUtf8 Include="VersionBytes" Value="4.5.6" />
</ItemGroup>

This generates the following class:

#nullable enable
internal static partial class ProjectInfo
{
    public const string Version = "1.2.3";
    public static global::System.ReadOnlySpan<byte> VersionBytes => "4.5.6"u8;
}
  • ProjectInfoString generates a public const string.
  • ProjectInfoUtf8 generates a ReadOnlySpan<byte> property using a "..."u8 literal. This requires C# 11 or later (and a target that has ReadOnlySpan<byte>, e.g. the System.Memory package on .NET Framework).
  • The item name (Version) is the member name, and the Value metadata is the value (an empty or missing Value generates ""). Nothing is generated if you don't declare any items.

The class is generated in your project's <RootNamespace> if one is set, otherwise in the global namespace. It is internal and partial by default; set <ProjectInfoVisibility>public</ProjectInfoVisibility> to make it public.

Diagnostics

Invalid items are reported as errors and skipped; other items are still generated.

ID Meaning
NEPI001 The item name is not a valid C# identifier (or is ProjectInfo)
NEPI002 The item name is defined more than once (the first definition wins)
NEPI003 No longer used: an empty Value generates an empty string
NEPI004 ProjectInfoUtf8 is used with a language version lower than C# 11
NEPI005 An item could not be read: values containing a back-quote (`) are not supported
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-beta4 1,936 10/30/2026
0.1.0-beta3 64,519 10/26/2026
0.1.0-beta2 381 10/22/2026
0.1.0-beta1 56 10/22/2026

## 0.1.0-beta4

### Fixes

* Allow empty `Value`s, which generate an empty string (`""` / `""u8`) instead of reporting NEPI003. NEPI003 is no longer used.

## 0.1.0-beta3

### Fixes

* Fix builds failing on MSBuild versions earlier than 18.3 (e.g. the .NET 7, 8 and 9 SDKs), which don't allow `System.Uri` in property functions.

## 0.1.0-beta2

### Fixes

* Fix NEPI001 (empty item name) when only one of `<ProjectInfoString>` or `<ProjectInfoUtf8>` is declared

## 0.1.0-beta1

### Features

* Add `<ProjectInfoString>` and `<ProjectInfoUtf8>` items, which are echoed into a generated `ProjectInfo` class as `const string` values and `ReadOnlySpan<byte>` UTF-8 literals
* Add the `ProjectInfoVisibility` MSBuild property to make the generated class `public`
* Add diagnostics NEPI001-NEPI005 for invalid items


See https://github.com/andrewlock/NetEscapades.ProjectInfo/blob/main/CHANGELOG.md#v010-beta4 for more details.