How to get the value of INSTALLDIR in wix - wix

Am copying files to INSTALLDIR using wix. And how do i get the path of copied file location. I want to use the value(path) of INSTALLDIR.
Thanks in Advance

Using [INSTALLDIR]. Directories with capital letters also act as property.
If you can use VbScript Custom Actions, then you can try this:
Msgbox Session.Property("INSTALLDIR")

Related

Folder property of File Search Launch Condition: how to specify custom folder under [TARGETDIR]?

I'm trying to set a file search launch condition for my installer. I need it to search for a specified file in a subfolder of my [TARGETDIR] folder.
I tried setting the Folder property to:
[TARGETDIR]/Subfolder
[TARGETDIR]Subfolder
[TARGETDIR]Subfolder/
[TARGETDIR]/Subfolder/
[TARGETDIR]/"Subfolder"
None of the above solutions worked. The file located in subfolder never gets found. It works if I only specify [TARGETDIR] with the Depth property set to 1, but I would rather specify directly the directory to search.
I found a similar question here, but there is no answer.
What is the correct way to set the Folder property to work with a custom folder ?
The difficulty here is that TARGETDIR is not set until later than the search is done, so it has no value yet. Even if if it did have a value, it's what is changed by the browse dialog that can change where the user installs thet app (see the property window of Application Folder in File System on Target Machine).
This means you must use standard folder properties in your search. If you want to search what you think may be where the file is installed, then use:
[ProgramFilesFolder]SomeFolder\SomeOtherFolder
or something similar if your assumed value of TARGETDIR is in Program Files x86.

Is there a built in way to hide a file in Wix?

The company I work for has recently taken to generating MSI files with Wix. We're at the tail end of the process, but there's one more thing they need me to do.
We have an XML file with a snapshot of what binaries have gone into the install. However, the customers we deliver to will get somewhat confused about an extra useless file in the install.
Most everything that comes up when I search for 'Wix' and 'hide file' is focused on removing or deleting the files after install. I just need to hide this sucker though.
Is there a way to hide the file through HEAT or something? I can modify the file element in the WXS using XSL or Powershell if need be. Or do I need to resort to a custom action that calls cmd.exe to hide it?
You can try setting the file element's hidden attribute to yes. Taken from here:
Set to yes in order to have the file's hidden attribute set when it is installed on the target machine.

How can I change the text in the Wix installer dialog?

My text message is stuck to "Install My Product to:"
How can I change this?
("My Product" is the name of my product and the string above is resolved based on the Name attribute in my Product.wxs).
I have 2 dialogs and the second requires a different message.
Some text on the built-in dialogs can be changed with variables specified in the localization file for your language. This is a simpler task than if you are trying to change text that is not kept in a variable.
This process is documented here.
However, if that's the case, the recommended way to change the dialog on the install page is to make a copy of and change the template file(s) provided with the WiX installation.
Copy the relevant .wxs files from your WiX dialog extension set (you will need to make sure you installed the WiX source) you want to modify and copy the file that specifies the UI extension name. Modify it to suit your needs and change the names.
When you compile your installer, you will use your new extension name (referring to your modified dialog set) and tell candle/light where your modified .wxs files are.
This process has some good documentation here and here.
Following the entire tutorial at the second link should get you pretty far.
Good luck

Wix Copyfile and components order

I'd like to move some files from where the directory is installed to a second location with a MSI.
I created a component that refers to the second directory and added there the CopyFile element:
<CopyFile Id="copy" DestinationProperty="AUSTORAGE" SourceProperty="PFSTORAGE" SourceName="*.*" Delete="yes" />
It doesn't seem to copy anything but after taking a look at the logs its seems like the component that copy the files is executed before the files are copied to the first directory during the installation.
Is there any way to control the secuence of the components? Or any better aproach to copy the files (all the files in a directory)?
Just move your CopyFile element under the File element (the file you'd like to copy after it is installed), and it will appear in the right order. The point here is the DuplicateFile table functionality (the one Ciprian mentions here) is also included into the CopyFile element logic. See CopyFile element help for more details.
You cannot use a CopyFile operation because the MoveFiles action (which copies the files) comes before the InstallFiles action durring install.
Please take look at the DuplicateFile table which will copy files after the files are deployed.
http://msdn.microsoft.com/en-us/library/aa368335(VS.85).aspx

Copy files from Setup location to installation dir

I am working on my Wix project and have 2 questions:
1) How can I copy file from the same location as my .msi is to the destination folder specified during installation. This file is not part of .msi package but a customized file that needs to be copied after the installer copies the main code files.
2) If this customized file is not available at the location where .msi file is, then I need to show up a OpenFile Dialog so that user can specify the location of this file.
In short, by default the installer should look for the customized file at the same location where the installer is and if the file is not available then show OpenFile Dialog.
Any suggestion or sample code snippet would be very helpful as I am bit new to WIX world.
Thanks for your time.
Ok, first thing you should find out if the file is there. Use DirectorySearch/FileSearch elements for this.
Next, based on the file search result (it will end up in a certain property) schedule and condition a new dialog. You can find how to customize your dialog UI sequence here.
And finally, use CopyFile element to do the copy work.