NetChris.Build.MSBuild 1.1.444315244

dotnet add package NetChris.Build.MSBuild --version 1.1.444315244
NuGet\Install-Package NetChris.Build.MSBuild -Version 1.1.444315244
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="NetChris.Build.MSBuild" Version="1.1.444315244">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetChris.Build.MSBuild --version 1.1.444315244
#r "nuget: NetChris.Build.MSBuild, 1.1.444315244"
#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.
// Install NetChris.Build.MSBuild as a Cake Addin
#addin nuget:?package=NetChris.Build.MSBuild&version=1.1.444315244

// Install NetChris.Build.MSBuild as a Cake Tool
#tool nuget:?package=NetChris.Build.MSBuild&version=1.1.444315244

NetChris.Build.MSBuild

Provides:

  • Consistent versioning of assemblies and packages

Use

In your project's *.csproj file:

  • Set <VersionPrefix /> to the {Major}.{Minor} version of your project
  • Add the reference: dotnet add package NetChris.Build.MSBuild
  • Alternately, directly add the PackageReference in your project, using the appropriate major and minor versions:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard1.1</TargetFramework>
    <AssemblyName>NetChris.MyAssembly</AssemblyName>
    <RootNamespace>NetChris.Standard.MyAssembly</RootNamespace>

    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    
    <VersionPrefix>0.2</VersionPrefix>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="NetChris.Build.MSBuild" Version="0.3.*">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
</Project>

This relies on this blurb from "Include MSBuild props and targets in a package":

You might want to add custom build targets or properties in projects that consume your package, such as running a custom tool or process during build. You do this by placing files in the form <package_id>.targets or <package_id>.props [...] within the \build folder of the project.

Variables during build

There are a few properties you can set to vary the versioning. These values can also be supplied through environment variables. They are primarily of use in CI/CD scenarios.

Property Use Recommended source
SemVerPatch The SemVer patch version. Pipeline ID
SemVerPrerelease The SemVer pre-release version, if any Assuming Pipeline ID for the patch version, just a simple "prerelease" static string.
AssemblyVersionBuild The build number to use for the assembly (and file) [version]https://docs.microsoft.com/en-us/dotnet/api/system.version) Pipeline IID (i.e. project-specific pipeline ID) to keep ⇐ UInt16.MaxValue - 1
AssemblyVersionRevision The revision number to use for the assembly (and file) version For now, hard-set to 0

References

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on NetChris.Build.MSBuild:

Package Downloads
NetChris.Logging

Tools for working with logging

NetChris.Logging.AspNetCore

Tools for working with logging in ASP.NET Core

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.444315244 580 1/9/2022
1.0.439274985 410 12/30/2021
0.3.438810264 310 12/30/2021
0.2.438803359 299 12/30/2021
0.0.437716649 339 12/28/2021