mirror of
https://github.com/dotnet/skills.git
synced 2026-09-20 09:49:54 +08:00
25 lines
1.0 KiB
XML
25 lines
1.0 KiB
XML
<Project Sdk="Microsoft.NET.Sdk">
|
|
<PropertyGroup>
|
|
<TargetFramework>net8.0</TargetFramework>
|
|
</PropertyGroup>
|
|
|
|
<Target Name="GenerateTimestamp" BeforeTargets="CoreCompile">
|
|
<PropertyGroup>
|
|
<TimestampFile>$(IntermediateOutputPath)build-timestamp.txt</TimestampFile>
|
|
</PropertyGroup>
|
|
<WriteLinesToFile File="$(TimestampFile)" Lines="Built at: $([System.DateTime]::Now.ToString())" Overwrite="true" />
|
|
</Target>
|
|
|
|
<Target Name="EmbedGitHash" BeforeTargets="CoreCompile">
|
|
<Exec Command="git rev-parse HEAD" ConsoleToMsBuild="true" IgnoreExitCode="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitHash" />
|
|
</Exec>
|
|
<WriteLinesToFile File="$(IntermediateOutputPath)git-hash.g.cs"
|
|
Lines="namespace IncrementalBroken { internal static class BuildInfo { public const string GitHash = "$(GitHash)"%3B } }"
|
|
Overwrite="true" />
|
|
<ItemGroup>
|
|
<Compile Include="$(IntermediateOutputPath)git-hash.g.cs" />
|
|
</ItemGroup>
|
|
</Target>
|
|
</Project>
|