Skip to content

Commit

Permalink
Include commit SHA in [AssemblyInformationalVersion] value (#22649)
Browse files Browse the repository at this point in the history
* Add `[AssemblyMetadata("CommitHash", ...)]` to all C# assemblies
- see dotnet/arcade#5866 discussion
- provide the commit SHA though not in usual `[AssemblyInformationalVersion]` format

* Include `[AssemblyMetadata("Serviceable", "true")]` too
- see dotnet/arcade#1526
  • Loading branch information
dougbu committed Sep 23, 2020
1 parent 52952c8 commit a41d020
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,21 @@
PrivateAssets="all"
IsImplicitlyDefined="true" />
</ItemGroup>

<Target Name="GetCustomAssemblyAttributes"
BeforeTargets="GetAssemblyAttributes"
Condition=" '$(MSBuildProjectExtension)' == '.csproj' "
DependsOnTargets="InitializeSourceControlInformation">
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(SourceRevisionId)' != ''">
<_Parameter1>CommitHash</_Parameter1>
<_Parameter2>$(SourceRevisionId)</_Parameter2>
</AssemblyAttribute>

<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(Serviceable)' == 'true'">
<_Parameter1>Serviceable</_Parameter1>
<_Parameter2>True</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>
</Project>

0 comments on commit a41d020

Please sign in to comment.