I am trying to support patches with Wix and was looking for answer like on this SO post
As suggested I used the "Using Purely WiX" code to do some testing and created 3 versions 1.0, 1.1 and 1.2
I can apply each of the MSI correctly to upgrade without errors and in ARP the version gets incremented.
I can patch from 1.0 or 1.1 to 1.2 but in ARP the version is not updated. As well after patching to 1.2 and running the 1.1 MSI installer, I then don't get the warning about downgrading.
Where am I going wrong here.
Here's the source:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Id='*' Name='Foobar $(var.Version)' UpgradeCode='PUT-GUID-HERE'
Language='1033' Codepage='1252' Version='$(var.Version).0.0' Manufacturer='Acme Ltd.'>
<Package Id='*' Keywords='Installer' Description="Acme's Foobar $(var.Version) Installer"
Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<MajorUpgrade DowngradeErrorMessage='A newer version is already installed.' />
<MediaTemplate EmbedCab='yes' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Acme' Name='Acme'>
<Directory Id='INSTALLDIR' Name='Foobar'>
<Component Id='MainExecutable' Guid='*'>
<File Id='SampleTXT' Name='Sample.txt' DiskId='1' Source='ver$(var.Version)\Sample.txt' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id='Complete' Level='1'>
<ComponentRef Id='MainExecutable' />
</Feature>
</Product>
</Wix>
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Patch AllowRemoval="yes" Manufacturer="Acme Ltd." MoreInfoURL="www.acmefoobar.com"
DisplayName="Foobar 1.1.0 Patch" Description="Small Update Patch" Classification="Update">
<Media Id='5000' Cabinet='Sample.cab'>
<PatchBaseline Id='Sample'/>
</Media>
<PatchFamily Id='SamplePatchFamily' Version='1.1.0.0' Supersede='yes'>
<ComponentRef Id='MainExecutable'/>
</PatchFamily>
</Patch>
</Wix>
and built with:
"%WIX_COMP_CMD%" -nologo -dVersion=1.0 Product.wxs
"%WIX_LINK_CMD%" -nologo Product.wixobj -out ver1.0\Product.msi
"%WIX_COMP_CMD%" -nologo -dVersion=1.1 Product.wxs
"%WIX_LINK_CMD%" -nologo Product.wixobj -out ver1.1\Product.msi
"%WIX_COMP_CMD%" -nologo -dVersion=1.2 Product.wxs
"%WIX_LINK_CMD%" -nologo Product.wixobj -out ver1.2\Product.msi
"%WIX_TORCH_CMD%" -nologo -p -xi ver1.0\Product.wixpdb ver1.2\Product.wixpdb -out Patch_0_2.wixmst
"%WIX_TORCH_CMD%" -nologo -p -xi ver1.1\Product.wixpdb ver1.2\Product.wixpdb -out Patch_1_2.wixmst
"%WIX_COMP_CMD%" -nologo Patch.wxs
"%WIX_LINK_CMD%" -nologo Patch.wixobj
"%WIX_PYRO_CMD%" -nologo Patch.wixmsp -out Patch.msp -t Sample Patch_0_2.wixmst -t Sample Patch_1_2.wixmst
Related
I need to create an MSI for distribution, the old story but new situation. I don't use Visual Studio, only the Wix Toolset (3.11.2.4516). My files are under the msi folder:
MyFolder
|
---msi
| |
| ---Sample1.txt
| |
| ---Sample2.txt
|
---build.bat
|
---Product.wxs
Basically, I do harvest those files from the msi folder into an msi.wxs:
heat dir msi -cg MsiFilesGroup -dr MsiDir -gg -sfrag -srd -out msi.wxs
and I get a ComponentGroup called MsiFilesGroup. The main part (Product.wxs) defines an interactive WixUI to guide the user during the installation.
These Product.wxs defines a feature what references the above files:
<?xml version="1.0" encoding="utf-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="B858BC76-AD11-45c3-A300-D1C6B73DFF56" Name="Pruders" Language="1033" Version="0.0.0.0"
UpgradeCode="{FA34F953-F659-4633-B8D2-893BF7A63642}" Manufacturer="Microsoft Corporation">
<Package Description="Test WIXUI_INSTALLDIR" Comments="TestWIXUI_INSTALLDIR"
InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Feature Id="TestFileProductFeature" Title="Test File Product Feature" Level="1">
<ComponentRef Id="MsiFilesGroup" />
</Feature>
<Property Id="SQLCLRTYPES">
<RegistrySearch Id="SqlClrTypesSearch" Root="HKLM" Type="raw"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
Name="KeyName1"/>
</Property>
<Property Id="WIXUI_INSTALLDIR" Value="TESTFILEPRODUCTDIR" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<Property Id="buttonGroup" Value="1" />
<UIRef Id="WixUI_InstallDir" />
</Product>
</Wix>
If I use ComponentRef for referencing I get this error:
error LGHT0094 : Unresolved reference to symbol 'Component:MsiFilesGroup'
in section 'Product:{B858BC76-AD11-45C3-A300-D1C6B73DFF56}'
If I use ComponentGroup, it fails in this way:
Product.wxs(8) : error CNDL0005 : The Feature element contains an unexpected child element 'ComponentGroup'.
light.exe : error LGHT0103 : The system cannot find the file 'Product.wixobj' with type 'Source'.
Any hint would be a greate help.
The build.bat contains the calls of Wix commands, as it follows:
#echo off
del *.msi
del *.wix*
del msi.wxs
heat dir msi -cg MsiFilesGroup -dr MsiDir -gg -sfrag -srd -out msi.wxs
candle msi.wxs
candle Product.wxs
light -ext WixUIExtension msi.wixobj Product.wixobj -out Product.msi
It is the light.exe command that you are lacking, and there are a number of other things you need to adjust as well.
Here are two slightly modified and simplified batch and WiX sources. Notice the two *.wixobj files fed to light.exe and the -var var.sourcefolder added in there to set the source directory:
Suggested "Build.cmd":
#echo off
heat dir msi -cg MsiFilesGroup -dr INSTALLFOLDER -gg -sfrag -srd -suid -var var.sourcefolder -out msi.wxs
candle -dsourcefolder="msi" msi.wxs >> Build.log
candle Product.wxs >> Build.log
light -ext WixUIExtension Product.wixobj msi.wixobj -out Product.msi >> Build.log
rem pause
Suggested (simplified) "Product.wxs" - I find that only the Mondo dialog set is working "on its own" without any modification or fiddling:
<?xml version="1.0" encoding="utf-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="B858BC76-AD11-45c3-A300-D1C6B73DFF56" Name="Pruders" Language="1033" Version="0.0.0.0"
UpgradeCode="{FA34F953-F659-4633-B8D2-893BF7A63642}" Manufacturer="Microsoft Corporation">
<Package Description="Test WIXUI_INSTALLDIR" Comments="TestWIXUI_INSTALLDIR"
InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Feature Id="TestFileProductFeature" Title="Test File Product Feature" Level="1">
<ComponentGroupRef Id="MsiFilesGroup" />
</Feature>
<UIRef Id="WixUI_Mondo" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Test Folder" />
</Directory>
</Directory>
</Fragment>
</Wix>
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="1" Version="1.0.0.0" Language="1033" Name="My Application Name" Manufacturer="My Manufacturer Name">
<Package InstallerVersion="300" Compressed="yes"/>
<Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />
<!-- Step 1: Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="My Application Name"/>
</Directory>
</Directory>
<!-- Step 2: Add files to your installer package -->
<!-- Copied from output from heat.exe -->
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="dirBF6284DAE096656A1A0B06AE3DCAA0C9" Name="MyAppName">
<Component Id="cmp26BABDEF350D4D06E3894ED92A9EA86E" Guid="8E1DA6FE-08EA-4D2E-8EBA-85131387A359">
<File Id="filEBD2DA63132D753815D44CEDC2ED5E88" KeyPath="yes" Source="SourceDir\benutzer.csv" />
</Component>
</Directory>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="MyComponentGroup">
<ComponentRef Id="cmp26BABDEF350D4D06E3894ED92A9EA86E" />
</ComponentGroup>
</Fragment>
<!-- Step 3: Tell WiX to install the files -->
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentGroupRef Id="MyComponentGroup" />
</Feature>
</Product>
</Wix>
Error:
error LGHT0094 : Unresolved reference to symbol ’Component:MyComponentGroup’ in section ’Product:*’.
I reduced the full code for this example, normally I would have many more files to be packaged. The component harvesting is done by heat.exe, I copied the components part into this wix file.
Although the error indicates what is the problem, I don't know what exactly to look for.
The code is run from a bat-file:
set WIX_BIN=c:\Program Files (x86)\WiX Toolset v3.11\bin\
echo Wix Toolset Bin Path: %WIX_BIN%
"%WIX_BIN%candle.exe" out.wxs -ext WixUtilExtension
if exist out.wixobj (
"%WIX_BIN%light.exe" -out out.msi out.wixobj -ext WixUIExtension -ext WixUtilExtension
)
pause
I am trying to create Single Package Authoring installation using following tutorial - http://www.egoroff.spb.ru/blog/62003.html
Main wix file is following:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='Foobar 1.0' Id='GUID' UpgradeCode='GUID'
Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme Ltd.'>
<Package Id='*' Keywords='Installer' Description="Acme's Foobar 1.0 Installer"
Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Property Id="ALLUSERS" Secure="yes" Value="2" />
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" />
<Property Id='ApplicationFolderName' Value="Acme" />
<Property Id='WixAppFolder' Value="WixPerUserFolder" />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Acme' Name='Acme'>
<Directory Id='INSTALLDIR' Name='Foobar 1.0'>
<Component Id='MainExecutable' Guid='GUID'>
<File Id='FoobarEXE' Name='FoobarAppl10.exe' DiskId='1' Source='FoobarAppl10.exe' KeyPath='yes'>
<Shortcut Id="startmenuFoobar10" Directory="ProgramMenuDir" Name="Foobar 1.0" WorkingDirectory='INSTALLDIR' Icon="Foobar10.exe" IconIndex="0" Advertise="yes" />
</File>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="Foobar 1.0">
<Component Id="ProgramMenuDir" Guid="GUID">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id='Complete' Title='Foobar 1.0' Description='The complete package.'
Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
<Feature Id='MainProgram' Title='Program' Description='The main executable.' Level='1'>
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='ProgramMenuDir' />
</Feature>
</Feature>
<Icon Id="Foobar10.exe" SourceFile="FoobarAppl10.exe" />
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_MySetup" />
</UI>
</Product>
</Wix>
According to this tutorial if application will be installed by plain user then it will be installed "per user", if application will be installed by administrator, then it should be installed "per machine".
In my case if I run msi file as a plain user then this test application is installed per user.
But if I run cmd.exe "as administrator" and then run created msi file from that administrator's cmd.exe application then application is installed per user again, not per machine.
What should I do to install application per machine?
Should I change something in wxs code?
Or should I install my application using some other approach?
Try setting ALLUSERS=1 on the msiexec.exe command line. This yields a per machine installation with shared shortcuts for all users:
msiexec.exe /i File.msi ALLUSERS=1
This relates to the larger issue of "Installation context". Check out the linked MSDN documentation.
Recommended links:
All users/Current user installation with/without Administrative privileges
Setting the 'AllUsers' option on Wix installer does not work
Authoring a single package for Per-User or Per-Machine Installation context in Windows 7
Hi I need to use Wix to execute some sql script but it seems the database is not created. After I made the installer and installed it. I didn't get any error and couldn't see anything wrong in the log file also. However, I can't find the database created anywhere. I even tried a simple example from online and got the same thing. I obviously did something wrong. I am suspicious it was the username and password. Here is the wxs file. The sql file is just some simple scripts to create a table. I hard coded the username, password and server name in it just to see if it works but it still doesn't.
The log file is like this:
MSI (s) (54!80) [17:47:12:108]: Creating MSIHANDLE (1505) of type 790531 for thread 12672
CreateDatabase: Error 0x80004005: failed to create to database: 'EasyLobby11', error: unknown error
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension' xmlns:sql='http://schemas.microsoft.com/wix/SqlExtension'>
<Product Name='Foobar 1.0' Id='YOURGUID-86C7-4D14-AEC0-86416A69ABDE' UpgradeCode='YOURGUID-7349-453F-94F6-BCB5110BA4FD'
Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme Ltd.'>
<Package Id='*' Keywords='Installer' Description="Acme's Foobar 1.0 Installer"
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />
<util:User Id='SQLUser' Name='[SQLUSER]' Password='[SQLPASSWORD]' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='InstallDir' Name='Acme'>
<Component Id='SqlComponent' Guid='YOURGUID-D8C7-4102-BA84-9702188FA316' KeyPath='yes'>
<sql:SqlDatabase Id='SqlDatabase' Database='Foobar' User='SQLUser' Server='[SQLSERVER]'
CreateOnInstall='yes' DropOnUninstall='yes' ContinueOnError='yes'>
<sql:SqlScript Id='CreateTable' BinaryKey='CreateTable' ExecuteOnInstall='yes' />
</sql:SqlDatabase>
</Component>
</Directory>
</Directory>
</Directory>
<Binary Id='CreateTable' SourceFile='CreateTable.sql' />
<Feature Id='SqlFeature' Title='SqlFeature' Level='1'>
<ComponentRef Id='SqlComponent' />
</Feature>
<Property Id='SQLUSER'>username</Property>
<Property Id='SQLPASSWORD'>password</Property>
<Property Id='SQLSERVER'>server</Property>
</Product>
</Wix>
I am new to WIX. In fact, this is my first project. So it should not be surprising that I am having issues.
I had my installer all setup and ready to roll, but this morning I needed a change made to my service, so I made the change and compiled. I build the WIX project and installed it. I started my service up and ran it, but the old code was executed. As it turns out, the old version of my service is still installed. Does this mean that the new version of the service was not packaged or that there was some kind of upgrade rule that I am missing? For some reason the PDB file got updated, but not the EXE.
Below is my wxs file. Please be kind...
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define AppName="My Service"?>
<?define MfgName="My Company"?>
<?define SourcePath="..\My Service\bin\$(var.Configuration)"?>
<Product Name="$(var.AppName)" Language="1033" Version="1.0.0.0" Manufacturer="$(var.MfgName)"
Id="*" UpgradeCode="063de86b-f12b-4af1-91ff-ce0917fffd5c" Codepage="1252">
<Package Id="*" Keywords="Installer" Description="$(var.AppName) Installer"
Manufacturer="$(var.MfgName)" Comments="My Service blah blah blah"
InstallerVersion="200" Compressed="yes" InstallScope="perMachine" SummaryCodepage="1252" />
<!--
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
-->
<Media Id="1" Cabinet="setup.cab" EmbedCab="yes" DiskPrompt="CD-ROM #1"/>
<Property Id="DiskPrompt" Value="$(var.AppName) Installer [1]"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="CompanyFolder" Name="$(var.MfgName)">
<Directory Id="INSTALLFOLDER" Name="$(var.AppName)">
<Component Id="ServiceFile" Guid="3688d9ee-08ed-4dde-87d8-3b7a752a99bf">
<File Id="ServiceEXE" Name="My Service.exe" DiskId="1" Source="$(var.SourcePath)\My Service.exe" KeyPath="yes" Vital="yes" />
<File Id="ServicePDB" Name="My Service.pdb" DiskId="1" Source="$(var.SourcePath)\MY Service.pdb" KeyPath="no" Vital="yes"/>
<File Id="LibraryDLL" Name="library.dll" DiskId="1" Source="$(var.SourcePath)\library.dll" KeyPath="no" Vital="yes"/>
<File Id="LibraryPDB" Name="library.pdb" DiskId="1" Source="$(var.SourcePath)\library.pdb" KeyPath="no" Vital="yes"/>
<File Id="Config" Name="My Service.exe.config" DiskId="1" Source="$(var.SourcePath)\My Service.exe.config" KeyPath="no" Vital="yes"/>
<ServiceInstall Id="InstallService" Name="MyService" Type="ownProcess" ErrorControl="normal" Start="auto"
DisplayName="$(var.AppName)" Description="My Service blah blah blah">
<ServiceConfig OnInstall="yes" DelayedAutoStart="yes" />
</ServiceInstall>
<ServiceControl Id="ControlService" Name="MyService" Remove="both" Stop="both" Wait="no"/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="MainFeature" Title="$(var.AppName) Setup" Level="1">
<ComponentRef Id="ServiceFile"/>
</Feature>
</Product>
</Wix>
If the installation was successful yet the file was not updated, you should log the install to see why. For example:
msiexec /i filename.msi /lvoicewarmupx log.txt
One reason for a file to not get updated is if Windows Installer checks the version of the existing file and it is newer than the version of the file you are trying to install.