Skip to content

Commit

Permalink
Deduplicate project properties before generation
Browse files Browse the repository at this point in the history
Avoids build failures due to misconfiguration.

Closes #172
  • Loading branch information
kzu committed Jan 28, 2023
1 parent 1eb951d commit 0f01535
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ThisAssembly.Project/ThisAssembly.Project.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@

<Target Name="InjectThisAssemblyProject" DependsOnTargets="$(InjectThisAssemblyProjectDependsOn)"
BeforeTargets="PrepareForBuild;CompileDesignTime;GenerateMSBuildEditorConfigFileShouldRun">
<ItemGroup>
<ProjectPropertyDistinct Include="@(ProjectProperty -> Distinct())" />
</ItemGroup>
<PropertyGroup>
<ThisAssemblyProject>@(ProjectProperty, '|')</ThisAssemblyProject>
<ThisAssemblyProject>@(ProjectPropertyDistinct, '|')</ThisAssemblyProject>
</PropertyGroup>
<ItemGroup Condition="'$(ThisAssemblyProject)' != ''">
<CompilerVisibleProperty Include="@(ProjectProperty)" />
Expand Down
1 change: 1 addition & 0 deletions src/ThisAssembly.Tests/ThisAssembly.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectProperty Include="Foo" />
<ProjectProperty Include="Foo" />
<Constant Include="Foo.Bar" Value="Baz" Comment="Yay!" />
<Constant Include="Foo.Hello" Value="World" Comment="Comments make everything better 😍" />
Expand Down

0 comments on commit 0f01535

Please sign in to comment.