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
Related
I am using WIX installer for my application everything working fine but when I uninstall the application the desktop icon and startmenu icon is still there.
Whats wrong with my xml. followed the steps given by Wix documentation.
help..
XML:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="applicationName" Language="1033" Version="1.0.0.0" Manufacturer="manufacturerName" UpgradeCode="PUT-GUID-HERE">
<Package Id="*" InstallerVersion="201" Compressed="yes" InstallScope="perMachine" Comments="Windows Installer Package" ReadOnly="yes" InstallPrivileges="elevated" />
<Feature Id="ProductFeature" Title="applicationName" Level="1">
<ComponentRef Id="Permission.INSTALLFOLDER" />
<ComponentRef Id="ApplicationDeskShortcutComp" />
<ComponentGroupRef Id="HeatGenerated" />
</Feature>
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="CompanyNameFolder" Name="CompanyName">
<Directory Id="INSTALLFOLDER" Name="applicationName">
<Component Id="Permission.INSTALLFOLDER" Guid="*">
<CreateFolder>
<Permission User="Everyone" GenericAll="yes" />
</CreateFolder>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="applicationName" />
</Directory>
</DirectoryRef>-->
<!--Add the shortcut to installer package For DeskTop-->
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationDeskShortcutComp" Guid="*" Win64="yes" >
<Shortcut Id="ApplicationDeskShortcut" Name="applicationName" Description="applicationName" Target="[INSTALLFOLDER]exeName.exe" WorkingDirectory="DesktopFolder" Icon="IconName.exe" >
</Shortcut>
<RemoveFolder Id="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Manufacturer\ProductName" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<Property Id="MYWIXUI_MONDO" Value="INSTALLFOLDER" />
<UIRef Id="MyWixUI_Mondo" />
<Icon Id="IconName.exe" SourceFile=".\Icons\MainLogo.ico" />
<Property Id="ARPPRODUCTICON" Value="IconName.exe" />
</Wix>
No time to test this right now, but could you first please try to change this:
<Directory Id="DesktopFolder" Name="applicationName" />
into this:
<Directory Id="DesktopFolder" />
DesktopFolder is a built-in Windows Installer folder that should resolve to the user's desktop folder or the common desktop folder for all users depending on the setting for ALLUSERS (per-machine or per-user installation).
During installation, MSI directory resolution (costing) will assign the correct value to DesktopFolder for the system you are running on (based on ALLUSERS setting). I thought anything you assign to DesktopFolder yourself in your WiX source would be wiped out as soon as directory resolution has run, so there is no direct logical reason why the above WiX markup change suggestion should work, but I think it should be tested. Please test on a clean virtual, if available.
What RegistryValue Root should be used in case of Single Package Authoring installation?
This is a simple Single Package Authoring installation:
<?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>
During installation registry key 'Software[Manufacturer][ProductName]' will be created under HKCU root.
It is correct in case of per user installation.
But I am not sure that it is correct in case of per machine installation.
It is impossible to use HKLM instead of HKCU - wix will not compile such a file.
There is the error "ICE38: Component ProgramMenuDir installs to user profile. It's KeyPath registry key must fall under HKCU" during compilation.
Is it a problem?
Or should I use HKCU in case of per user and per machine installations if I use Single Package Authoring installation?
Windows Installer XML uses the root type "HKMU" to the MSI type "(none)" (-1). See: Registry Table
(none) - 0x001 -1 If this is a per-user installation, the registry
value is written under HKEY_CURRENT_USER. If this is a per-machine
installation, the registry value is written under HKEY_LOCAL_MACHINE.
Note that a per-machine installation is specified by setting the
ALLUSERS property to 1.
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 using a WiX to install a service on test machine. But when I do that only the user who installed it on the machine is able to see in the 'Add/Remove Programs' control panel option. But I want to make it visible for every user on the machine.
I did some research and realized that I am not setting the AllUSERS property while creating the installer in the .wxs file.
So I updated my script with this line <Property Id="AllUSERS" Value="1"/> and created the installer. But still only the user who installed can see it in the Control Panel.
Here is my script to create the installer.
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='Importer Service' Id='PUT-GUID-HERE' UpgradeCode='PUT-GUID-HERE'
Language='1033' Codepage='1252' Version='$(var.version)' Manufacturer='Test'>
<Package Id='*' Keywords='Installer' Description="Imports data"
Manufacturer='Test' InstallerVersion='100' Languages='1033' Compressed='yes'
SummaryCodepage='1252' />
<Media Id='1' Cabinet='ImporterWebService.cab' EmbedCab='yes'
DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Importer Web Service 1.0 Installation [1]" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Property Id="AllUSERS" Value="1"/>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Test' Name='Test1'>
<Directory Id='INSTALLDIR' Name='Importer Service'>
<Component Id='MainExecutable' Guid='*'>
<File Id='ImporterWindowsServiceEXE'
Name='Importer.WindowsService.exe' DiskId='1'
Source='Importer.WindowsService.exe' KeyPath='yes'>
</File>
<ServiceInstall
Id="ImporterServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="Importer Service"
DisplayName="Importer Service"
Description="Imports data."
Start="demand"
Account="LocalSystem"
ErrorControl="ignore"
Interactive="no">
</ServiceInstall>
<ServiceControl Id="StartService" Stop="both" Remove="uninstall"
Name="Importer Service" Wait="yes" />
</Component>
<Component Id='FileHelpersLibrary' Guid='*'>
<File Id='FileHelpersDLL' Name='FileHelpers.dll' DiskId='1'
Source='FileHelpers.dll' KeyPath='yes' />
</Component>
<Component Id='CodeSmithDataLibrary' Guid='*'>
<File Id='CodeSmithDataDLL' Name='CodeSmith.Data.dll' DiskId='1'
Source='CodeSmith.Data.dll' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="Importer Service">
<Component Id="ProgramMenuDir" Guid="*">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU'
Key='Software\[Manufacturer]\[ProductName]'
Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id='Complete' Title='Importer Service'
Description='The complete package'
Display='hidden' Level='1' ConfigurableDirectory='INSTALLDIR'>
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='FileHelpersLibrary' />
<ComponentRef Id='CodeSmithDataLibrary' />
<ComponentRef Id='ProgramMenuDir' />
</Feature>
<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />
</Product>
</Wix>
Could someone please look at the script and let me know what I am doing wrong.
Thanks.
Instead of setting ALLUSERS explicitly, try setting the InstallScope of the Package element to perMachine. According to the documentation, this fact:
Set this value to declare that the package is a per-machine
installation and requires elevated privileges to install. Sets the
ALLUSERS property to 1.
So, it should do the required job under the hood.
I am new to WiX and I have been trying to create a installer for my application. Rest of things are working fine but I am stuck at one point.
I need to unzip a file once it is copied to Program Files Folder. I am not sure if windows can do it directly, so I got a unzip.exe from internet and it is working fine for unzipping. I have copied that file also in my Program Files Folder. But how do I unzip my file there. I tried the following code but with no result:-
**
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='Test' Id='xxxxxx' UpgradeCode='xxxxxxx'
Language='1033' Codepage='1252' Version='0.1.3' Manufacturer=''>
<Package Id='*' Keywords='Installer' Description=""
Comments='' Manufacturer=''
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Designer Installation [1]" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Test' Name='Test'>
<Component Id='unzip' Guid='xxxxxxx'>
<File Id='unzipexe' Name='unzip.exe' DiskId='1' Source='unzip.exe' KeyPath='yes' />
</Component>
<Component Id='sdk' Guid='xxxxxxxx'>
<File Id='SDK' Name='sdk.zip' DiskId='1' Source='sdk.zip' KeyPath='yes' />
</Component>
<Component Id='testlogger' Guid='xxxxxxx'>
<File Id='TestLog' Name='Test.log' DiskId='1' Source='Test.log' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id='Complete' Level='1'>
<ComponentRef Id='unzip' />
<ComponentRef Id='sdk' />
<ComponentRef Id='testlogger' />
</Feature>
<Property Id='Unzipper'>TARGETDIR\ProgramFilesFolder\Test\unzip.exe</Property>
<CustomAction Id='zipFile' Property='Unzipper' ExeCommand='sdk.zip' Return='asyncWait'/>
<InstallExecuteSequence>
<Custom Action='zipFile' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
**
Can someone help me out on this????
This isn't good Windows Installer design to install and then extract a ZIP. You should just extract the ZIP in your dev/build environment and author all of the files into the installer. Otherwise you are hiding all of the details of Windows Installer and losing all of the benefits that Windows Installer provides.