Skip to content

Commit

Permalink
Migrate WiX v3 to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
emoacht committed Jan 14, 2025
1 parent 6fb022d commit 4874fe9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 59 deletions.
34 changes: 2 additions & 32 deletions Source/Installer/Installer.wixproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="WixToolset.Sdk/5.0.2">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>053f50a8-e2c9-4f92-ba1b-b8f71603585f</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>Wifinian.Installer</OutputName>
<OutputType>Package</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
<SuppressIces>ICE69</SuppressIces>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<SuppressValidation>False</SuppressValidation>
<SuppressIces>ICE69</SuppressIces>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wifinian\Wifinian.csproj">
<Name>Wifinian</Name>
Expand All @@ -35,10 +21,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
<PackageReference Include="WixToolset.UI.wixext" Version="5.0.2" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources" />
Expand All @@ -47,17 +30,4 @@
<Content Include="Resources\banner.png" />
<Content Include="Resources\dialog.png" />
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
53 changes: 26 additions & 27 deletions Source/Installer/Product.wxs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Wifinian" Manufacturer="emoacht" Version="3.6.0"
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="Wifinian" Manufacturer="emoacht" Version="3.6.0"
Language="1033" Codepage="1252" UpgradeCode="{A8357D71-600C-462A-AEEE-BF1B988DD2E4}">
<Package Id="*" InstallerVersion="500" Compressed="yes"
InstallScope="perMachine" InstallPrivileges="elevated"
Description="Installer for Wifinian"/>
<SummaryInformation Description="Installer for Wifinian"/>

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>

Expand All @@ -14,31 +12,31 @@

<!-- UI -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>

<UI>
<UIRef Id="WixUI_InstallDir"/>
<ui:WixUI Id="WixUI_InstallDir"/>
<UIRef Id="WixUI_ErrorProgressText"/>

<!-- Skip License Agreement Dialog -->
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2"/>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2"/>
</UI>

<WixVariable Id="WixUIBannerBmp" Value="Resources\banner.png"/>
<WixVariable Id="WixUIDialogBmp" Value="Resources\dialog.png"/>

<Directory Id="TARGETDIR" Name="SourceDir">
<!-- Program Files -->
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="$(var.Wifinian.ProjectName)"/>
</Directory>
<!-- Program Files -->
<StandardDirectory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="$(var.Wifinian.ProjectName)"/>
</StandardDirectory>

<!-- Program Menu -->
<Directory Id="ProgramMenuFolder"/>
<!-- Program Menu -->
<StandardDirectory Id="ProgramMenuFolder"/>

<!-- Local AppData -->
<Directory Id="LocalAppDataFolder">
<Directory Id="ApplicationLocalAppDataFolder" Name="$(var.Wifinian.ProjectName)"/>
</Directory>
</Directory>
<!-- Local AppData -->
<StandardDirectory Id="LocalAppDataFolder">
<Directory Id="ApplicationLocalAppDataFolder" Name="$(var.Wifinian.ProjectName)"/>
</StandardDirectory>

<DirectoryRef Id="INSTALLDIR">
<Component Id="MainExecutable" Guid="{55649EB0-5DB2-4466-A042-969BF97139B0}">
Expand Down Expand Up @@ -122,15 +120,15 @@
Source="$(var.Wifinian.TargetDir)" Name="StartupAgency.dll" KeyPath="yes"/>
</Component>

<Component Id="VisualManifest" Guid="{4DD773D0-D642-40DC-9576-D535D0AF89EB}">
<Condition><![CDATA[VEM = "yes"]]></Condition>
<Component Id="VisualManifest" Guid="{4DD773D0-D642-40DC-9576-D535D0AF89EB}"
Condition="VEM = &quot;yes&quot;">
<File Id="VisualManifest"
Source="$(var.Wifinian.TargetDir)" Name="$(var.Wifinian.TargetName).VisualElementsManifest.xml" KeyPath="yes"/>
</Component>
</DirectoryRef>

<!-- Shortcut in Program Menu -->
<DirectoryRef Id="ProgramMenuFolder">
<StandardDirectory Id="ProgramMenuFolder">
<Component Id="ApplicationShortcut" Guid="{CA94F3D2-1BB8-4581-9B37-BA3C31049DC4}">
<Shortcut Id="ApplicationProgramMenuShortcut" Name="$(var.Wifinian.ProjectName)"
Target="[#MainExecutable]" WorkingDirectory="INSTALLDIR"
Expand All @@ -140,7 +138,7 @@
<RegistryValue Root="HKCU" Key="Software\[ProductName]"
Name="ApplicationShortcut" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
</StandardDirectory>

<!-- Working Folder in Local AppData -->
<DirectoryRef Id="ApplicationLocalAppDataFolder">
Expand Down Expand Up @@ -183,7 +181,8 @@
<CustomAction Id="CleanCurrentUserRun" Directory="TARGETDIR" Execute="immediate" Return="ignore"
ExeCommand="[SystemFolder]reg.exe delete HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v [ProductName] /f"/>
<InstallExecuteSequence>
<Custom Action="CleanCurrentUserRun" After="InstallFinalize">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
<Custom Action="CleanCurrentUserRun" After="InstallFinalize"
Condition="(NOT UPGRADINGPRODUCTCODE) AND (REMOVE=&quot;ALL&quot;)"/>
</InstallExecuteSequence>
</Product>
</Package>
</Wix>

0 comments on commit 4874fe9

Please sign in to comment.