PatchProductVersion 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package PatchProductVersion --version 1.0.1
NuGet\Install-Package PatchProductVersion -Version 1.0.1
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="PatchProductVersion" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PatchProductVersion --version 1.0.1
#r "nuget: PatchProductVersion, 1.0.1"
#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 PatchProductVersion as a Cake Addin
#addin nuget:?package=PatchProductVersion&version=1.0.1

// Install PatchProductVersion as a Cake Tool
#tool nuget:?package=PatchProductVersion&version=1.0.1

Purpose The package adds the revision information as AssemblyInformationalVersion attribute to an assembly. This same information is known as Product Version in the properties dialog of the Windows File explorer and Version property in the Sdk-style proj files. Sdk-style projects don't use the AssemblyInformationalVersion attribute. Instead they use the Version property defined in the .csproj file.

Per default the Version property is a concatenation of the AssemblyVersion property and the SourceRevisionId property. If the Version property has been explicitly defined (which must be the case, if you want to generate a package) the SourceRevisionId attribute will be concatenated to the Version attribute, if it exists.

The package takes advantage of this circumstance and creates a SourceRevisionId.props file, which contains the property definition.

PreRequisites This package works only inside a GIT repository.

Installation

install-package PatchProductVersion

How the package works For non-Sdk style proj files a file "AssemblyInformationalVersion.cs" is created. The code searches for the AssemblyInfo.cs file and extracts the assembly:AssemblyVersion attribute. The revision and current date is concatenated to the version string and placed as attribute into the file. You have to include the file into the project manually. Note: There is no support for languages other than c#.

Hint: Don't check in the generated file into the git repository, because it will be overwritten each time, a new revision has been committed.

For Sdk-style projects the SourceRevisionId will be generated in a new file SourceRevisionId.props. The package inserts an Import tag into the project file, so that the property is imported. After installation of the package you have to recompile twice to get the information into the compiled assembly. During the first compiler run the Import tag will be included in the project file. During the second run the imported property will be used. After this first use one compilation will be sufficient.

Hint: Don't check in the generated file into the git repository, because it will be overwritten each time, a new revision has been committed. Hint: After you changed and checked in your code you need to recompile to get the appropriate revision into your assembly.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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
1.0.3 478 1/28/2022
1.0.1 686 1/22/2020

Initial release