I'm trying to build a very simple installer that just installs the package as a "per-user" application. No dialogs, just always install into the local app data folder. And it's ignoring me. And always installing to C:\Program Files.
I've set the InstallScope to "perUser", but left the installation directory as "ProgramFilesFolder". The documentation seems to suggest that that SHOULD get redirected, but that isn't happening.
Setup file below...
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="MyApplication"
Language="1033"
Version="1.0.0"
Manufacturer="MyCompany"
UpgradeCode="19E4E10A-558C-4D4A-BD2A-D6B8060FB917">
<Package
InstallerVersion="500"
Compressed="yes"
InstallPrivileges="limited"
InstallScope="perUser" />
<MajorUpgrade
DowngradeErrorMessage="A newer version of MyApplication is already installed." />
<MediaTemplate
EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyCompany MyApplication">
<Directory Id="JreFolder" Name="jre"/>
<Directory Id="LibFolder" Name="lib"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="MyCompany MyApplication"/>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Component Id="CMP_MyApplication.exe">
<File Id="FILE_MyApplication.exe" Source="MyApplication.exe" KeyPath="yes"/>
</Component>
<Component Id="CMP_MyApplication.ini">
<File Id="FILE_MyApplication.l4j.ini" Source="MyApplication.l4j.ini" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="CMP_StartMenuShortcut" Guid="0B96A876-70FB-4E8E-8D27-B9B1E40C9B4D">
<Shortcut Id="ApplicationStartMenuShortcut" Name="MyCompany MyApplication" Description="MyCompany MyApplication"
Target="[#FILE_MyApplication.exe]" WorkingDirectory="INSTALLDIR"/>
<RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\MyCompany\MyApplication" Name="Installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1" >
<ComponentGroupRef Id="JreGroup"/>
<ComponentGroupRef Id="LibGroup"/>
<ComponentRef Id="CMP_MyApplication.exe"/>
<ComponentRef Id="CMP_MyApplication.ini"/>
<ComponentRef Id="CMP_StartMenuShortcut"/>
</Feature>
</Product>
</Wix>
If you know that you want to install to the app data folder why use the 'ProgramFilesFolder'?
This will only confuse you (or any other person that will maintain your code) - try using the 'AppDataFolder' instead.
Related
I created a MSI installer to install per-user.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Id="*"
Language="1033"
Manufacturer="my company"
Name="my software"
UpgradeCode="{9B85A1B0-6914-4573-92C1-27A6DB849E1D}"
Version="2.0.0.0">
<Package
Compressed="yes"
Description="a software"
InstallerVersion="500"
InstallScope="perUser"
Manufacturer="my company"
Comments="copyright" />
<MediaTemplate EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="AppDataFolder">
<Directory Id="ManufacturerFolder" Name="MyCompany">
<Directory Id="INSTALLFOLDER" Name="MySoftware">
</Directory>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="ManufacturerFolder">
<Component Id="cmp_manufacturer" Guid="{264B9740-7BF6-4D90-9F0A-5B9489687C96}">
<RegistryValue
Root='HKCU'
Key='Software\MyCompany\MySoftware\Product'
Name='reg_manufacturer'
Value='manufacturer'
Type='string'
KeyPath='yes' />
<RemoveFolder Id="removeManufacturerFolder" On="uninstall" />
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="cmp_install" Guid="{0CF4AFFB-9676-4944-BCE7-9B0F54704677}">
<RegistryValue
Root='HKCU'
Key='Software\MyCompany\MySoftware\Product'
Name='reg_install'
Value='install'
Type='string'
KeyPath='yes' />
<File Id="file_install" Source="installfile.txt" />
<RemoveFolder Id="removeInstallFolder" On="uninstall" />
</Component>
</DirectoryRef>
<UIRef Id="WixUI_InstallDir" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Feature
Id="MainFeature"
Title="My Software"
Level="1">
<ComponentRef Id="cmp_manufacturer" />
<ComponentRef Id="cmp_install" />
</Feature>
</Product>
</Wix>
It works well if using default install folder C:\Users\xxx\AppData\Roaming\MyCompany\MySoftware. The file installfile.txt can be removed on uninstall. If I changed the install folder to a different folder using the WiXUI, the file installfile.txt can be copied to the right folder, But the copied file cannot be removed on uninstall. So why that file cannot be removed on uninstall, how to fix this?
I'll appreciate any help.
Fairly new to Wix. I have a working msi, but instead of a cab file next to the msi file, I am just getting a folder. I have spent several days trying to figure out why it is not putting the files in a cab file but I am completely at a loss.
The msi file performs exactly as I expect, but distributing the msi alongside a folder is less desirable than just the msi.
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="[Name]" Language="1033" Manufacturer="[Manufacturer]" Version="2.0.30"
UpgradeCode="af66ae21-61e4-4926-954d-ee89acf95ab3">
<Package InstallerVersion="200"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [Name] is already installed." />
<MediaTemplate/>
<Feature Id="ProductFeature" Title="[Title]" Level="1">
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
<ComponentGroupRef Id="WebApp" />
<ComponentGroupRef Id="ControlApp" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="ManufacturerName" Name="[Name]">
<Directory Id="INSTALLLOCATION" Name="[Name]" />
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="[Name]"/>
<Directory Id="DesktopFolder" Name="Desktop"></Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="844b584d-6d5f-4825-9541-c7caf74892fb">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="[Name]"
Description="[Name]"
Target="[INSTALLLOCATION]MyApp.exe"
WorkingDirectory="INSTALLLOCATION" />
<RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Name]" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="629d0ac6-8c63-4309-af33-975925584d1f">
<Shortcut Id="ApplicationDesktopShortcut"
Name="[Name]"
Description="[Name]"
Target="[INSTALLLOCATION]MyApp.exe"
WorkingDirectory="INSTALLLOCATION" />
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Name]" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
Set the Package/#Compressed attribute to yes.
I´m using a Wix project to generate an installer MSI file.
My project needs to be installed in a specific folder (like C:\MyProject\Version1), not the default Program Files folder. My folder desired structure:
c:\MyProject\Version1
|
|--- MyProject.exe
|--- Utils.dll
|--- README.txt
|
|--- data
|----- config.ini
Here is my Wix configuration:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"><?define eMyProjectConnectionTest_TargetDir=$(var.eMyProjectConnectionTest.TargetDir)?><?define MyProject_TargetDir=$(var.MyProject.TargetDir)?><?define MyProjectCheckLicenses_TargetDir=$(var.MyProjectCheckLicenses.TargetDir)?>
<Product Id="1609421b-de6a-4285-b190-861ce626ab5e" Name="MyProject" Language="1033" Version="3.3.0" Manufacturer="MyProject Software LLC" UpgradeCode="f1fb7395-ff04-4eb9-942b-5c6ff889808c">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- EmbedCab="yes" adds the CAB file to the instlal file -->
<MediaTemplate EmbedCab="yes"/>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
<Component Id="MyProject.exe" Guid="cbea4919-c7a7-4264-925f-7c7c58a952b3">
<File Id="MyProject.exe" Name="MyProject.exe" Source="$(var.MyProject_TargetDir)MyProject.exe" />
</Component>
<!-- Added files -->
<Component Id="Utils.dll" Guid="192fee52-79e1-43cb-81c8-b8af9d4d9ecc">
<File Id="Utils.dll" Source="Files/Utils.dll" KeyPath="yes"/>
</Component>
<Component Id="README.txt" Guid="c8c74065-5dd9-44d0-83ab-8838bea143e3">
<File Id="README.txt" Source="Files/README.txt" KeyPath="yes"/>
</Component>
</ComponentGroup>
<!-- Adds a start menu shortcut -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MyProject">
<Directory Id="data" Name="data">
<Component Id="config.ini" Guid="8f9ee1cf-6a8a-4cc7-8d40-47c337dd9ff2">
<File Id="config.ini" Source="Files/config.ini" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="MyProject"/>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
<Directory Id="ApplicationDesktopFolder" Name="MyProject"/>
</Directory>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="33776559-768b-4dbb-a924-984146edf8fb">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="MyProject"
Description="MyProject"
Target="[#MyProject.exe]"
WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="CleanUpStartMenuShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\MyProject" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="09a53fb1-0447-4849-9bc4-3971f5fdbbad">
<Shortcut Id="ApplicationDesktopShortcut"
Name="MyProject"
Description="MyProject"
Target="[#MyProject.exe]"
WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="CleanUpDesktopShortCut" Directory="ApplicationDesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\MyProject" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Feature Id="ProductFeature" Title="MyProjectSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="config.ini"/>
<ComponentRef Id="ApplicationShortcut"/>
<ComponentRef Id="ApplicationShortcutDesktop"/>
</Feature>
</Product>
</Wix>
You need add the tag <Directory Id="INSTALLFOLDER"> outside of ProgramFilesFolder
First time doing some Wix practice, so im completely new to it.
Here is my short script:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SampleMSI" Language="1033" Version="1.0.0.0" Manufacturer="Nunya" UpgradeCode="b2c39f9b-1de1-433e-bc59-a3548cc531b9">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="Installs Signout Utility" Keywords="Practice,Signout,Utility,MSI,Installer" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SampleMSI" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SampleMSI" />
<Directory Id="APPFOLDER" Name="APPDir" >
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="CMP_ADispOCX"
Guid="5E23B839-35CA-480E-8AFC-2E914BA8E32A"
Directory="INSTALLLOCATION">
<File Id="FILE_ADispocx"
Source="ADisp.ocx"
KeyPath="yes" />
</Component>
<Component Id="CMP_Abtn32ocx"
Guid="98B357F2-C295-4019-A878-885E56AA3BF3"
Directory="INSTALLLOCATION">
<File Id="FILE_Abtn32a20ocx"
Source="btn32a20.ocx"
KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
I just wanted to make sure they are going to the same folder, basic installation check. (it is my first time)
I get this error however:
Error 2 The Component/#Directory attribute cannot be specified when the Component element is nested underneath a Directory element.
I get it twice for each component id I have.
Am I missing something? Im using Wix 3.6 A Developers Guide for reference.
edit: Side question......how do I specify an exact path? like C:\Herp\Derp
You don't need to specify the directory of a Component if you did so already in the ComponentGroup element. Remove the Directory attribute in both Components elements in your fragment.
Change your code to this
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="CMP_ADispOCX"
Guid="5E23B839-35CA-480E-8AFC-2E914BA8E32A">
<File Id="FILE_ADispocx"
Source="ADisp.ocx"
KeyPath="yes" />
</Component>
<Component Id="CMP_Abtn32ocx"
Guid="98B357F2-C295-4019-A878-885E56AA3BF3">
<File Id="FILE_Abtn32a20ocx"
Source="btn32a20.ocx"
KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
When I try to use merge module feature in VS2010, I am getting an issue "Multiple Section entery"
Why i am getting this error?
I have done googling but I did not get any thread where i got my answer.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Module Id="ModuleTest" Language="1033" Version="1.0.0.0">
<Package Id='94290AA7-50E3-414E-A1BD-FC3C2B0C47D8' Description='My first Merge Module'
Comments='This is my first attempt at creating a Windows Installer Merge Module'
Manufacturer='TravelPort Private Limited' InstallerVersion='200' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='MyModuleDirectory' Name='.'>
<Component Id='MyModuleComponent' Guid='93F36B4B-B6E0-4000-8174-2660C0AE9D6A'>
<File Id='readme' Name='ReadMeModule' Source='ReadMergeModule.txt' DiskId='1' KeyPath='yes' Checksum='yes'></File>
</Component>
</Directory>
</Directory>
</Module>
</Wix>
product.wxs file
<Product Id="ec20ec5e-bb50-45d0-9190-156cf146c8f3" Name="WinDemoApp" Language="1033" Version="1.0.0.0" Manufacturer="WinDemoApp" UpgradeCode="979e03f4-3b50-43c1-9dde-dd675f726fde">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="WinDemoApp">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
</Directory>
<Directory Id ="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="WinDemoApp"></Directory>
</Directory>
<!--<Merge Id='MyModule' Language='1033' SourceFile='Module.msm' DiskId='1' />-->
</Directory>
</Directory>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="MyApp.exe" Guid="36AA7C63-ED57-40C6-8B14-843B9355C265">
<File Id="MyApp.exe" Source="D:\WIXDemo\WinDemoApp\MyApp\bin\Debug\MyApp.exe" KeyPath="yes" Checksum="yes"></File>
</Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="EA549460-4D98-4B09-B621-D4F1AA12A617">
<Shortcut Id="ApplicationStartMenuShortcut" Name="WinDemoApp"
Description="My Win Installer sample"
Target="[APPLICATIONROOTDIRECTORY]MyApp.exe"
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
<RemoveFolder Id ="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\WinDemoApp" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!--<Icon Id="bug.ico" SourceFile="bug.ico"/>
<Property Id="ARPPRODUCTICON" Value="bug.ico" />-->
<Feature Id="MyApplication" Title="WinDemoApp" Level="1">
<!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
<ComponentRef Id="MyApp.exe"/>
<ComponentRef Id="ApplicationShortcut"/>
<!--<MergeRef Id="MyModule"/>-->
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
</Feature>
</Product>
The MyModuleDirectory directory element shouldn't have a name attribute. Also your Merge element should probably be nested underneath the ApplicationProgramsFolder directory. Where it's now it'll go to [ProgramFilesFolder].
Take a look at Industrial Strength Windows Installer XML.
Even if you don't want to use the tool, it's own installer is setup exactly the way you are setting up yours with merge modules consumed by a product.