Updated to include new dir, inclusion of tags. Version appears in Control Panel now. Also appears in TItlebar of AppWindow.

This commit is contained in:
2025-10-10 14:32:49 +08:00
parent bab6cf7b75
commit 62cf2425b1
4 changed files with 170 additions and 83 deletions

View File

@@ -1,32 +1,46 @@
<!--
This file allow for customizing your build process.
This file allows for customizing your build process.
See: https://learn.microsoft.com/visualstudio/msbuild/customize-your-build
-->
<Project>
<!--
Uncomment if you need to enable inclusion of another Directory.Build.props file from a parent directory
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
-->
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>12</LangVersion>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<!--
If you you like to see source generated files saved to disk you can enable the following:
https://learn.microsoft.com/dotnet/csharp/roslyn-sdk/source-generators-overview?WT.mc_id=DT-MVP-5003472
-->
<!--<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>-->
</PropertyGroup>
<!--
This allows all projects to share the same user secrets file.
If you want project to have their own, set it to a different GUID on each project.
See: https://learn.microsoft.com/dotnet/architecture/microservices/secure-net-microservices-web-applications/developer-app-secrets-storage
-->
<PropertyGroup Label="User Secrets">
<UserSecretsId>1ef91ee6-7b55-474e-ab2b-2d164b723a56</UserSecretsId>
</PropertyGroup>
</Project>
<!-- 🔹 Automatically derive version from latest Git tag -->
<Target Name="GetVersionFromGit" BeforeTargets="GetAssemblyVersion">
<!-- Get the most recent tag (like v1.1.1) -->
<Exec Command="git describe --tags --abbrev=0" ConsoleToMSBuild="true" IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitTag" />
</Exec>
<!-- Strip leading 'v' if present -->
<PropertyGroup>
<GitVersion>$([System.Text.RegularExpressions.Regex]::Replace('$(GitTag)', '^v', ''))</GitVersion>
</PropertyGroup>
<!-- Fallback if no tags exist yet -->
<PropertyGroup Condition="'$(GitVersion)' == ''">
<GitVersion>0.0.0</GitVersion>
</PropertyGroup>
<!-- Apply to assembly and file versions -->
<Message Text="🔖 Using version: $(GitVersion)" Importance="High" />
<PropertyGroup>
<Version>$(GitVersion)</Version>
<FileVersion>$(GitVersion)</FileVersion>
<AssemblyVersion>$(GitVersion)</AssemblyVersion>
</PropertyGroup>
</Target>
</Project>