Implementing MSI packaging
This commit is contained in:
226
SetupWufuc/Product.wxs
Normal file
226
SetupWufuc/Product.wxs
Normal file
@@ -0,0 +1,226 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<?define ProductName = "Wufuc - Windows Update fixer" ?>
|
||||
<?define ProductFullVersion = "!(bind.FileVersion.LibraryFile)" ?>
|
||||
<?define ProductAuthor = "Jeffy" ?>
|
||||
<?define ProductAppFolder = "InstallLocation" ?>
|
||||
<?if $(var.Platform) = x64 ?>
|
||||
<?define ProductDisplayName = "$(var.ProductName) 64-bit" ?>
|
||||
<?define ProductId = "C8BE2142-DBD1-45BD-B564-7EE5035E05E5" ?>
|
||||
<?define ProductUpgradeCode = "CC5091C5-2A7A-41F6-8B64-F036D9553A30" ?>
|
||||
<?define Win64 = "yes" ?>
|
||||
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
|
||||
<?define WindowsSystemFolder = "System64Folder" ?>
|
||||
<?else ?>
|
||||
<?define ProductDisplayName = "$(var.ProductName)" ?>
|
||||
<?define ProductId = "C8BE2142-DBD1-45BD-B532-7EE5035E05E5" ?>
|
||||
<?define ProductUpgradeCode = "CC5091C5-2A7A-41F6-8B32-F036D9553A30" ?>
|
||||
<?define Win64 = "no" ?>
|
||||
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
||||
<?define WindowsSystemFolder = "SystemFolder" ?>
|
||||
<?endif ?>
|
||||
|
||||
<Product
|
||||
Id="$(var.ProductId)"
|
||||
Name="$(var.ProductName)"
|
||||
Language="1033"
|
||||
Version="$(var.ProductFullVersion)"
|
||||
Manufacturer="$(var.ProductAuthor)"
|
||||
UpgradeCode="$(var.ProductUpgradeCode)">
|
||||
<Package
|
||||
InstallerVersion="200"
|
||||
Compressed="yes"
|
||||
InstallScope="perMachine"
|
||||
Manufacturer="$(var.ProductAuthor)"
|
||||
Platform="$(var.Platform)" />
|
||||
|
||||
<?if $(var.Platform) = x86 ?>
|
||||
<Condition Message="This application can not be installed on x64 machine.">
|
||||
<![CDATA[Not VersionNT64]]>
|
||||
</Condition>
|
||||
<?endif ?>
|
||||
|
||||
<Condition Message="This application is only supported on Windows 7, 8.1, 2008 R2 or 2012 R2.">
|
||||
<![CDATA[Installed OR (VersionNT = 601) OR (VersionNT = 603)]]>
|
||||
</Condition>
|
||||
|
||||
<Media Id="1" Cabinet="media.cab" EmbedCab="yes" />
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
||||
|
||||
<Property Id="APPLICATIONFOLDER" Secure="yes">
|
||||
<RegistrySearch
|
||||
Id='AppFolderRegistrySearch'
|
||||
Type='raw'
|
||||
Root='HKLM'
|
||||
Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\[WIX_UPGRADE_DETECTED]'
|
||||
Name='$(var.ProductAppFolder)'
|
||||
Win64='$(var.Win64)' />
|
||||
</Property>
|
||||
|
||||
<Property Id="ApplicationFolderName" Value="$(var.ProductName)" />
|
||||
|
||||
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
|
||||
<WixVariable Id="WixUISupportPerUser" Value="0" />
|
||||
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<!-- Program files -->
|
||||
<Directory Id="$(var.PlatformProgramFilesFolder)" >
|
||||
<Directory Id="APPLICATIONFOLDER" Name="$(var.ProductName)"/>
|
||||
</Directory>
|
||||
|
||||
<!-- Start menu (shortcuts) -->
|
||||
<Directory Id="ProgramMenuFolder" >
|
||||
<Directory Id="ShortcutsFolder" Name="$(var.ProductName)"/>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<DirectoryRef Id="APPLICATIONFOLDER">
|
||||
<!-- Windows service -->
|
||||
<!--
|
||||
<Component
|
||||
Id="ServiceComponent"
|
||||
Guid="C9E9EA0D-AC74-4833-870E-5BE0D05A15BE"
|
||||
Win64="$(var.Win64)">
|
||||
|
||||
<File
|
||||
Id="ServiceFile"
|
||||
Name="$(var.wufuc.TargetFileName)"
|
||||
Source="$(var.wufuc.TargetPath)"
|
||||
/>
|
||||
|
||||
<ServiceInstall Id="ServiceInstall"
|
||||
Name="WufucSvc"
|
||||
DisplayName="$(var.ProductName) Service"
|
||||
Type="ownProcess"
|
||||
Interactive="no"
|
||||
Start="auto"
|
||||
Vital="yes"
|
||||
ErrorControl="normal"
|
||||
Description="Service to bypass compatibility processor check for updates." />
|
||||
<ServiceControl Id="ServiceControl"
|
||||
Name="WufucSvc"
|
||||
Stop="both"
|
||||
Remove="uninstall"
|
||||
Wait="yes" />
|
||||
</Component>
|
||||
-->
|
||||
<!-- Readme file -->
|
||||
<Component
|
||||
Id="TextComponent"
|
||||
Guid="1ACD536E-FFCC-47D4-8D3B-8D91D236EE45"
|
||||
Win64="$(var.Win64)">
|
||||
|
||||
<File
|
||||
Id="ReadmeFile"
|
||||
Name="readme.txt"
|
||||
Source="$(var.SolutionDir)README.md"
|
||||
KeyPath="yes">
|
||||
</File>
|
||||
</Component>
|
||||
|
||||
<!-- Shared library -->
|
||||
<Component
|
||||
Id="LibraryComponent"
|
||||
Guid="551F05C0-9A41-49FF-A967-6ACB9E7BC200"
|
||||
Win64="$(var.Win64)">
|
||||
|
||||
<File
|
||||
Id="LibraryFile"
|
||||
Name="$(var.wufuc.TargetFileName)"
|
||||
Source="$(var.wufuc.TargetPath)"
|
||||
KeyPath="yes"
|
||||
Vital="yes"
|
||||
Checksum="yes"
|
||||
/>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<!-- Starte menu program shortcuts -->
|
||||
<DirectoryRef Id="ShortcutsFolder">
|
||||
|
||||
<!-- Shortcuts for readme file and uninstaller -->
|
||||
<Component
|
||||
Id="ShortcutsComponent"
|
||||
Guid="480D426B-6954-4C78-BFB3-A3C95E48BB15"
|
||||
Win64="$(var.Win64)">
|
||||
|
||||
<Shortcut
|
||||
Id="ReadmeShortcut"
|
||||
Name="ReadMe"
|
||||
Description="Help and information"
|
||||
Target="[APPLICATIONFOLDER]readme.txt"
|
||||
WorkingDirectory="APPLICATIONFOLDER"
|
||||
/>
|
||||
|
||||
<Shortcut
|
||||
Id="UninstallShortcut"
|
||||
Name="Uninstall"
|
||||
Description="Uninstall Wufuc"
|
||||
Target="[$(var.WindowsSystemFolder)]msiexec.exe"
|
||||
Arguments="/x [ProductCode]"
|
||||
/>
|
||||
|
||||
<RemoveFolder
|
||||
Id="ShortcutsRemoveFolder"
|
||||
On="uninstall"
|
||||
/>
|
||||
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\$(var.ProductName)"
|
||||
Name="installed"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"
|
||||
/>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<!-- Common components -->
|
||||
<ComponentGroup Id="CommonComponentGroup">
|
||||
<ComponentRef Id="ShortcutsComponent"/>
|
||||
<ComponentRef Id="TextComponent"/>
|
||||
<ComponentRef Id="LibraryComponent"/>
|
||||
</ComponentGroup>
|
||||
|
||||
|
||||
<Feature
|
||||
Id="CompleteInstall"
|
||||
Title="Complete Install"
|
||||
Level="1"
|
||||
Description="Installs the $(var.ProductName) Windows service.">
|
||||
|
||||
<ComponentRef Id="ShortcutsComponent"/>
|
||||
<ComponentRef Id="TextComponent"/>
|
||||
<ComponentRef Id="LibraryComponent"/>
|
||||
<ComponentGroupRef Id="CommonComponentGroup"/>
|
||||
</Feature>
|
||||
|
||||
<SetDirectory Id="APPLICATIONFOLDER" Value="[$(var.PlatformProgramFilesFolder)][ApplicationFolderName]">
|
||||
APPLICATIONFOLDER=""
|
||||
</SetDirectory>
|
||||
|
||||
<CustomAction
|
||||
Id="OverwriteWixSetDefaultPerMachineFolder"
|
||||
Property="WixPerMachineFolder"
|
||||
Value="[APPLICATIONFOLDER]"
|
||||
Execute="immediate"
|
||||
/>
|
||||
|
||||
<!-- Save destination folder in Add/Remove programs (ARP) registry key -->
|
||||
<SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" After="CostFinalize" />
|
||||
|
||||
<WixVariable Id="WixUILicenseRtf" Value="$(var.SolutionDir)LICENSE.rtf" />
|
||||
|
||||
<InstallUISequence>
|
||||
<Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
|
||||
</InstallUISequence>
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
|
||||
<DeleteServices>NOT UPGRADINGPRODUCTCODE</DeleteServices>
|
||||
</InstallExecuteSequence>
|
||||
<UIRef Id="WixUI_Advanced"/>
|
||||
|
||||
</Product>
|
||||
</Wix>
|
70
SetupWufuc/SetupWufuc.wixproj
Normal file
70
SetupWufuc/SetupWufuc.wixproj
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>3.10</ProductVersion>
|
||||
<ProjectGuid>2761679f-06d6-4ab0-ba47-01f1bd7bf55f</ProjectGuid>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputName>SetupWufuc</OutputName>
|
||||
<OutputType>Package</OutputType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
<DefineConstants>Debug</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||
<DefineConstants>Debug</DefineConstants>
|
||||
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Product.wxs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\wufuc\wufuc.vcxproj">
|
||||
<Name>wufuc</Name>
|
||||
<Project>{00f96695-ce41-4c2f-a344-6219dfb4f887}</Project>
|
||||
<Private>True</Private>
|
||||
<DoNotHarvest>
|
||||
</DoNotHarvest>
|
||||
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
|
||||
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WixExtension Include="WixUIExtension">
|
||||
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
|
||||
<Name>WixUIExtension</Name>
|
||||
</WixExtension>
|
||||
</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>
|
||||
<PropertyGroup>
|
||||
<!-- Rename Installer -->
|
||||
<PostBuildEvent>
|
||||
if not exist "$(ProjectDir)msi" mkdir "$(ProjectDir)msi"
|
||||
copy "!(TargetPath)" "$(ProjectDir)msi\$(TargetName)-$(PlatformName)$(TargetExt)" /Y /V
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!--
|
||||
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>
|
Reference in New Issue
Block a user