Skip to content

Commit

Permalink
Feature: add a post-clean target to remove temp files generated by Co…
Browse files Browse the repository at this point in the history
…re.csproj
  • Loading branch information
uxmal committed Feb 15, 2024
1 parent 01f9404 commit 6cac1b7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,23 @@

<PropertyGroup>
<CustomAssemblyInfoFile>$([System.IO.Path]::Combine($(MSBuildProjectDirectory), obj\AssemblyData.Extra.cs))</CustomAssemblyInfoFile>
<HashFileName>$(BaseIntermediateOutputPath)githash.txt</HashFileName>
</PropertyGroup>
<!-- includes the CustomAssemblyInfo for compilation into your project -->
<ItemGroup>
<Compile Include="$(CustomAssemblyInfoFile)" />
</ItemGroup>


<!-- Regenerates CustomAssemblyInfoFile, if the git hash changed -->
<Target Name="UpdateGitHash" BeforeTargets="CoreCompile">
<UpdateGitHash
HashFileName="$(BaseIntermediateOutputPath)githash.txt"
HashFileName="$(HashFileName)"
TemplateFileName="$(ProjectDir)AssemblyData.Extra.cs.template"
OutputFileName="$(CustomAssemblyInfoFile)">
</UpdateGitHash>
</Target>

<Target Name="CleanGitHash" AfterTargets="Clean">
<Delete Files="$(HashFileName)" />
<Delete Files="$(CustomAssemblyInfoFile)" />
</Target>
</Project>

0 comments on commit 6cac1b7

Please sign in to comment.