Skip to content

Commit

Permalink
Adjust AssemblyInformationalVersion after NBGV: no metadata in public…
Browse files Browse the repository at this point in the history
… versions
  • Loading branch information
rdeago committed Nov 9, 2023
1 parent cb92eb2 commit 37da24c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changes to existing features

- When using NerdBack.GitVersioning, the value of `AssemblyInformationalVersion` is now changed to not include metadata (Git commit SHA) when building a public version (i.e. from `main` or other branches identified in `version.json`).
This change also affects the default names of zipped publish folders and InnoSetup-generated setup programs, as they use `AssemblyInformationalVersion` as a suffix.

### Bugs fixed in this release

### Known problems introduced by this release
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project>

<ItemGroup Condition="$(UseNerdbankGitVersioning)">
<BV_PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="All" />
</ItemGroup>

<Target Name="BV_AdjustAssemblyInformationalVersion"
AfterTargets="GetBuildVersion">

<!--
NpmPackageVersion is a SemVer2 version that has no Git commit metadata in public builds.
https://github.com/dotnet/Nerdbank.GitVersioning/blob/v3.6.133/src/NerdBank.GitVersioning/VersionOracle.cs#L379
This is the value we want for AssemblyInformationalVersion.
-->
<PropertyGroup>
<AssemblyInformationalVersion>$(NpmPackageVersion)</AssemblyInformationalVersion>
</PropertyGroup>

</Target>

</Project>
10 changes: 2 additions & 8 deletions src/Buildvana.Sdk/Modules/NerdbankGitVersioning/Module.targets
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<Project>

<!--
Add a reference to Nerdbank.GitVersioning if needed.
Do not add the reference if a version file was not found;
if there is a reachable version file outside HomeDirectory, NB.GV may erroneously use it.
-->
<ItemGroup Condition="$(UseNerdbankGitVersioning)">
<BV_PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="All" />
</ItemGroup>
<Import Project="Module.Core.targets"
Condition="$(UseNerdbankGitVersioning)" />

<!-- Import stub targets if NB.GV is not used. -->
<Import Project="Module.Stubs.targets"
Expand Down

0 comments on commit 37da24c

Please sign in to comment.