I'm using what appears to be the standard XML for a WiX install. Generally things work like expected for the defaults.
Sometimes I would like to install on another drive but, use the standard directory. What seems to be right idea is to specify TARGETDIR=D: on the msi command line:
nonsenseInstaller.msi TARGETDIR=D: /log=Install.log
Typically ProgramFilesFolder is set to: C:\Program Files (x86)\
Below is my WiX XML, pretty standard stuff. What is happening is that ProgramFilesFolder already has C: baked in. Is there a standard WiX way to override this with TARGETDIR? (Or another command line property?)
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Draeger' Name='Dyer Heavy Industries'>
<Directory Id='APPLICATIONROOTDIRECTORY' Name='Build Tools'></Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="New Build Email"/>
</Directory>
</Directory>
<Directory Id="FontsFolder" SourceName="Fonts Folder"></Directory>
</Directory>
In this case you'd want to say msiexec intaller.msi APPLICATIONROOTDIRECTORY=D:\SomePath
I do see a couple problems with your XML though. ProgramMenuFolder should be a child of TARGETDIR not ProgramFilesFolder. Also APPLICATIONROOTFOLDER should typically be called INSTALLLOCATION to match most WiX convention.
Related
I am deploying one MSI via msiexec.exe, but when I specify the path=D:\folder_name, the folder is not created.
Code:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLDIR" Name="bin" />
</Directory>
</Fragment>
From the above code, I can achieve folder "bin" but I want that "bin" should go into the folder which will get created via msiexec.exe i.e
msiexec.exe /i /path/to/msi /quiet PATH=Drive/Folder_name
Can we have a workaround so that if the folder is not present then it should create it and should put the "bin" in that folder?
You need to specify the TARGETDIR and not PATH. Try the following:
msiexec.exe /i /path/to/msi TARGETDIR="DRIVE/Folder_name" /qb
It's not clear what you're asking because:
Why is PATH in your msiexec command line? If you want to specify the actual directory you should perhaps be using INSTALLDIR=....
The Directory element seems incomplete. Typically you'd have something like:
Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="MyName">
<Directory Id="MYDIR" Name="Fred" />
</Directory>
</Directory>
</Directory>
and use INSTALLDIR in the command line to specify the name within ProgramFiles or TARGETDIR to customize the entire path, or MYDIR to change the name "Fred".
To get to the question: a folder is created by specifying that files will be installed there. Maybe more of your source would show that.
If you want to create an empty directory it's done with a CreateFolder element inside a component, as here in the WiX docs:
Creating an empty folder
This is not in your question, but silent installs that require elevation will fail because silent means that the UAC elevation prompt will not be shown, and the install will proceed with limited privileges and fail.
I am making a Windows installer and I am using the following directory structure for the installation path:
<Directory Id="ProgramFilesFolder">
<Directory Id="Company" Name="CompanyName">
<Directory Id="INSTALLFOLDER" Name="ProductName" />
</Directory>
</Directory>
The above code snippet will install my app in the "Program Files (x86)" folder. My application only runs on a 64 bit version of Windows so I would like to install it in the Program Files folder instead. How can I do this?
Use ProgramFiles64Folder instead of ProgramFilesFolder.
Besides that, set:
Product/Package/#Platform="x64"
Product/Package/#InstallerVersion to at least 200
Component/#Win64="yes"
For .NET assemblies:
File/#ProcessorArchitecture="x64"
I install my application to a specific folder using the below wxs code:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="CompanyName">
<Directory Id="SUBDIR" Name="Application Launcher">
<Component Id="ApplicationFiles" Guid="*">
<File Name="app.exe" Id="AppFile1" Source="app.exe" Vital="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
I want to specify the installation folder with a parameter to be given from the command line like below:
msiexec.exe /i setup.msi PATH=C:\MyCompany\Folder\ /qn
Thanks a lot.
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="CompanyFolder" Name="CompanyName">
<Directory Id="INSTALLLOCATION" Name="Application Launcher">
<Component Id="ApplicationFiles" Guid="*">
<File Name="app.exe" Id="AppFile1" Source="app.exe" Vital="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
For your install:
msiexec /I setup.msi INSTALLLOCATION=C:\Somewhere /qn
I am adding as an answer to get proper links. You should check out Wix's auto-generate GUID feature: WIX Autogenerate GUID *?
This feature allows you to stop generating your own GUIDs and have Wix take care of them in an "automagic" way. I haven't tested it, but anything that makes your source file cleaner, shorter, and easier to maintain is worth trying. It also makes it easier to share Wix snippets without people reusing your generated GUID.
Maybe also check out:
How To: Generate a GUID
Change my component GUID in wix?
WIX Autogenerate GUID *
Rob Mensching (Wix author) states it is safe for normal use
And one more thing with regards to properties. In general all PUBLIC properties (uppercase) can be set on the command line. If you want to use these properties in deferred mode custom actions you need to check out the concept of restricted public properties and the SecureCustomProperties property. Some Installshield info too. And a nice old Wise article.
I need to install file in the regular installation folder (i.e. c:\program files\mycompany\myapp) but I also need to copy files into a subfolder located in the windows folder i.e. c:\windows\myfolder.
While I have no problem with the "install" folder, I can't see how to create a sub-folder in c:\windows?
Any ideas?
Thanks.
Thierry
UPDATE:
I probably should have been a bit more precise and provide additional information. This is the xml I have:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MyCompany">
<Directory Id="ClientFolder" Name="Client">
</Directory>
<Directory Id="ServerFolder" Name="Server">
</Directory>
</Directory>
</Directory>
</Directory>
<Directory Id="WindowsFolder" Name="WindowsFolder">
<Directory Id="MyFolder" Name="MyFolder"></Directory>
</Directory>
</Fragment>
When I try to compile my wix project, I get the following error:
Error 1 : The Directory with Id 'WindowsFolder' is not a valid root directory.
There may only be a single root directory per product or module and its Id attribute
value must be 'TARGETDIR' and its Name attribute value must be 'SourceDir'
PS: I'm new to this and I'm reading a book on how to use Wix, but I need this asap, so please be patient with me :). Thank you.
You create Directory elements based on System Folder Properties. Specifically the WindowsFolder property. Then create a child Directory element for your folder.
You should have very strong justification before doing this as this is an operating system area. I typically tell developers no unless they have a very, very good reason.
The penny dropped!!
You need to add a directory reference directly under
<Directory Id="TARGETDIR" Name="SourceDir">
along with the rest of your directories. You'll end up with something like this
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MyApp">
<Directory Id="ClientFolder" Name="Client"/>
</Directory>
</Directory>
<Directory Id="WindowsFolder">
<Directory Id="MyFolder" Name="MyFolder"/>
</Directory>
</Directory>
Where the WindowsFolder will tell the installer to use the "windows" folder and to use the sub folder within it, just set the Directory your ComponentGroup (or other) to MyFolder i.e.
<ComponentGroup Id="MyFolderComponents" Directory="MyFolder">
..
..
</ComponentGroup>
That regular installation folder of yours is based on a tree that will have ProgramFilesFolder somewhere, and then your subfolder name. You do the same for the Windows folder using the standard Windows Installer property:
Windows Folder
which is one of this bunch:
Property Reference
I have an MSI file that is installing a folder with a bunch of files inside it. I have a location that I am putting the files in:
Windows XP:
C:\Documents and Settings\All Users\Documents\MyFolder
Windows 7:
C:\Users\Public\Documents\MyFolder
The issue is that I do not want to hardcode these paths, but no matter where I look I cannot find out how to do this, because everywhere I look they are talking about making shortcuts for all users and that is not what I am trying to do. How can one install a folder to an "All Users" location?
Something like this:
<PropertyRef Id="WIX_DIR_COMMON_DOCUMENTS" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WIX_DIR_COMMON_DOCUMENTS">
<Directory Id="MyFolder" Name="MyFolder">
Windows Installer does not have a property for that folder, but a WiX-provided custom action does.
Per the documentation on the OSInfo custom actions:
Reference the WixUtilExtension extension for the linker.
Define the property via a reference:
<PropertyRef Id="WIX_DIR_COMMON_DOCUMENTS" />
Then, define the directory somewhere under the TARGETDIR directory. For example:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WIX_DIR_COMMON_DOCUMENTS">`
<Directory Id="MyFolder" Name="MyFolder" />`
</Directory>`
</Directory>`