Skip to content

Commit

Permalink
Fix backs-compat generation when custom namespace in use
Browse files Browse the repository at this point in the history
We were not properly conditioning the new ThisAssembly-based generation on the usage of a custom ThisAssemblyNamespace, causing P2P scenarios to fail since we were simultaneously generating in the custom namespace *and* the global one.

Fixes #258
  • Loading branch information
kzu committed Mar 22, 2023
1 parent f8063c3 commit 8303091
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 1 addition & 6 deletions src/GitInfo/build/GitInfo.AssemblyMetadata.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@
==============================================================
-->

<PropertyGroup>
<GitThisAssemblyMetadata Condition="'$(GitThisAssemblyMetadata)' == ''">false</GitThisAssemblyMetadata>
</PropertyGroup>

<Target Name="GitAssemblyMetadata" DependsOnTargets="GitInfo;GitVersion"
BeforeTargets="BuildOnlySettings" Condition="'$(GitThisAssemblyMetadata)' == 'true'">
<Target Name="GitAssemblyMetadata" DependsOnTargets="GitInfo;GitVersion" BeforeTargets="BuildOnlySettings">

<ItemGroup Condition="'$(Language)' != 'VB'">
<AssemblyMetadata Include="GitInfo.IsDirty"
Expand Down
9 changes: 6 additions & 3 deletions src/GitInfo/build/GitInfo.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1074,9 +1074,12 @@
</PropertyGroup>
</Target>

<Import Project="GitInfo.AssemblyInfo.targets"/>
<Import Project="GitInfo.AssemblyMetadata.targets" Condition="'$(Language)' != 'C#' or '$(ThisAssemblyNamespace)' != ''"/>
<Import Project="GitInfo.ThisAssembly.targets" Condition="'$(Language)' == 'C#'"/>
<Import Project="GitInfo.AssemblyMetadata.targets" Condition="'$(GitThisAssemblyMetadata)' == 'true'"/>

<!-- Legacy generation in place for non-C# or when the unsupported ThisAssemblyNamespace is in use -->
<Import Project="GitInfo.AssemblyInfo.targets" Condition="'$(Language)' != 'C#' or '$(ThisAssemblyNamespace)' != ''"/>
<!-- Otherwise, for C# we always use ThisAssembly instead. -->
<Import Project="GitInfo.ThisAssembly.targets" Condition="'$(Language)' == 'C#' and '$(ThisAssemblyNamespace)' == ''"/>

<PropertyGroup>
<GitInfoImported>true</GitInfoImported>
Expand Down

0 comments on commit 8303091

Please sign in to comment.