feat: auto-generate CalVer version from build date
Replace hardcoded AssemblyVersion/AssemblyFileVersion with a CalVer scheme (YYYY.M.D.HHmm) generated at build time via an MSBuild target that writes a CalVer.cs file into obj/ before compilation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a13d30f0b2
commit
c702263770
3 changed files with 13 additions and 7 deletions
|
|
@ -388,4 +388,16 @@
|
|||
<Error Condition="!Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" />
|
||||
<!-- Auto-generate CalVer version: YYYY.M.D.HHmm -->
|
||||
<Target Name="SetCalVer" BeforeTargets="CoreCompile">
|
||||
<PropertyGroup>
|
||||
<CalVerVersion>$([System.DateTime]::UtcNow.ToString("yyyy.M.d.HHmm"))</CalVerVersion>
|
||||
<CalVerFile>$(IntermediateOutputPath)CalVer.cs</CalVerFile>
|
||||
</PropertyGroup>
|
||||
<WriteLinesToFile File="$(CalVerFile)" Overwrite="true"
|
||||
Lines="using System.Reflection%3B;[assembly: AssemblyVersion("$(CalVerVersion)")];[assembly: AssemblyFileVersion("$(CalVerVersion)")]" />
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CalVerFile)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
@ -21,10 +21,4 @@ using System.Runtime.InteropServices;
|
|||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9b6a07e1-ae78-47f4-b09c-174f6a27d7a3")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
[assembly: AssemblyVersion("4.0.0.2")]
|
||||
[assembly: AssemblyFileVersion("4.0.0.2")]
|
||||
// Version is auto-generated at build time (CalVer: YYYY.M.D.HHmm)
|
||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue