Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/msbuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Property | Default | Description
`NBGV_ThisAssemblyNamespace` | (empty) | Sets the namespace to use for the generated `ThisAssembly` class.
`NBGV_EmitThisAssemblyClass` | `true` | When `false`, suppresses generation of the `ThisAssembly` class.
`NBGV_ThisAssemblyIncludesPackageVersion` | `false` | When `true`, a `NuGetPackageVersion` property is added to the `ThisAssembly` class.
`NBGV_UseAssemblyVersionInNativeVersion` | `true` | When `false`, uses the `AssemblyFileVersion` as a native `PRODUCTVERSION`.

### Custom `ThisAssembly` static fields and constants

Expand Down
4 changes: 3 additions & 1 deletion src/Nerdbank.GitVersioning.Tasks/NativeVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ BLOCK NBGV_VERSION_BLOCK

public string TargetFileName { get; set; }

public bool UseAssemblyVersionInNativeVersion { get; set; } = true;

/// <inheritdoc/>
public override bool Execute()
{
Expand Down Expand Up @@ -166,7 +168,7 @@ private void CreateDefines()
return;
}

if (!Version.TryParse(this.AssemblyVersion, out Version productVersion))
if (!Version.TryParse(this.AssemblyVersion, out Version productVersion) || !this.UseAssemblyVersionInNativeVersion)
{
productVersion = fileVersion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
AssemblyLanguage="$(AssemblyLanguage)"
AssemblyCodepage="$(AssemblyCodepage)"
TargetFileName="$(TargetFileName)"
UseAssemblyVersionInNativeVersion="$(NBGV_UseAssemblyVersionInNativeVersion)"
/>
<!-- Avoid applying the newly generated Version.rc file to the build
unless it has changed in order to allow for incremental building. -->
Expand Down