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,34 +1,56 @@
<Project Sdk="WixToolset.Sdk/6.0.0">
<ItemGroup>
<PackageReference Include="WixToolset.UI.wixext" />
</ItemGroup>
<PropertyGroup>
<!-- Force embedding files into the MSI (no external .cab file) -->
<EmbedCab>true</EmbedCab>
</PropertyGroup>
<PropertyGroup>
<WixExtensionInclude>WixToolset.UI.wixext</WixExtensionInclude>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>PublishDir=C:\Users\Sonder\source\repos\psg-oversight-app\PublishDir</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Content Include="Assets\DLShortcut.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\trayicon.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<WixSource Include="HarvestedFiles.wxs" />
</ItemGroup>
<ItemGroup>
<Content Include="bpl.rtf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Assets\windowsdesktop-runtime-8.0.13-win-x64.exe" />
</ItemGroup>
</Project>
<!-- ✅ Defaults -->
<PropertyGroup>
<Version>0.0.0</Version>
<Platform>x64</Platform>
<InstallerPlatform>x64</InstallerPlatform>
<EmbedCab>true</EmbedCab>
<WixExtensionInclude>WixToolset.UI.wixext</WixExtensionInclude>
</PropertyGroup>
<!-- ✅ STEP 1: Run Git BEFORE WiX compilation -->
<Target Name="SetVersionFromGit" BeforeTargets="BeforeBuild">
<Exec Command="git describe --tags --abbrev=0" ConsoleToMSBuild="true" IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitTag" />
</Exec>
<PropertyGroup Condition="'$(GitTag)' != ''">
<GitTagTrimmed>$([System.Text.RegularExpressions.Regex]::Replace('$(GitTag)', '\s', ''))</GitTagTrimmed>
<GitVersion>$([System.Text.RegularExpressions.Regex]::Replace('$(GitTagTrimmed)', '^v', ''))</GitVersion>
<Version>$(GitVersion)</Version>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>
Version=$(Version);
PublishDir=C:\Users\Sonder\source\repos\psg-oversight-app\PublishDir
</DefineConstants>
<OutputName>OversightInstaller_$(Version)_$(Platform)</OutputName>
</PropertyGroup>
<Message Text="📦 Building OversightInstaller version $(Version)" Importance="high" />
<Message Text="📦 WiX DefineConstants=$(DefineConstants)" Importance="high" />
</Target>
<!-- ✅ STEP 2: Rename the MSI after build -->
<Target Name="RenameMsi" AfterTargets="Build">
<PropertyGroup>
<BuiltMsi>$(OutputPath)OversightInstaller_$(Version)_$(Platform).msi</BuiltMsi>
<ActualMsi>$(OutputPath)OversightInstaller.msi</ActualMsi>
</PropertyGroup>
<Message Text="📦 Renaming $(ActualMsi) → $(BuiltMsi)" Importance="high" />
<Exec Command="move /Y &quot;$(ActualMsi)&quot; &quot;$(BuiltMsi)&quot;" />
</Target>
<ItemGroup>
<PackageReference Include="WixToolset.UI.wixext" />
<WixSource Include="HarvestedFiles.wxs" />
<Content Include="Assets\DLShortcut.ico" CopyToOutputDirectory="Always" />
<Content Include="Assets\trayicon.ico" CopyToOutputDirectory="Always" />
<Content Include="bpl.rtf" CopyToOutputDirectory="Always" />
<None Include="Assets\windowsdesktop-runtime-8.0.13-win-x64.exe" />
</ItemGroup>
</Project>