I want to know how to set the installation path of the copied files by using properties. So, please let anyone explain the answer.
-
You don't wanna use **InstallDirDlg**? Basicly its just `
` element and its own child, so if you want install in _c:/programfiles/sample_ you simple create structure: ` – Buzka91 Oct 28 '14 at 13:19 ` you should read [this HOW TO](http://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/add_a_file.html). You add components in **Directory Id="APPLICATIONROOTDIRECTORY"** :) -
What exactly are you looking for? Are you trying to pass the install path while running the MSI? or are you trying to set the install path by reading from registry or something like that? – Isaiah4110 Oct 28 '14 at 17:43
-
I need to set the installation path in the property. Then want to refer that property in custom action. This is what i want.. – Kathir Oct 29 '14 at 03:35
2 Answers
If You are using a bootstrapper, You can define a variable like that:
<Variable Name="INSTALLFOLDER"
bal:Overridable="yes"
Type="string"
Value="[ProgramFilesFolder]"/>
This variable has the ProgramFilesFolder as default, but it can be overwritten. You can set it either in Process.Start (when the bootstrapper is called by an EXE) as parameter or - if You have programmed Your own bootstrapper-GUI - You set the variable in the GUI-code.
In the MsiPackage You must set the variable into the MsiProperty INSTALLLOCATION, which You define in the Product.wxs of the MSI-project. Hope it helps You.
<MsiPackage Id='SetupPackage'
SourceFile='.\Resources\Setup.msi'
Permanent='no'
Cache='yes'
DisplayInternalUI='no'
Vital='yes'
Compressed='yes'
EnableFeatureSelection='no'
DisplayName='MySetup'>
<MsiProperty Name="INSTALLLOCATION"
Value="[INSTALLFOLDER]" />
</MsiPackage>

- 1,649
- 3
- 22
- 49
I know this may be too late to answer, but someone may find it useful.
Every Directory element defined in your Wix project can be accessed as a property using its Id:
For example if you have:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="My Directory" />
</Directory>
</Directory>
</Fragment>
You will have a property named INSTALLFOLDER and you will be able to access it from your custom actions.
Take a look to my answer here, that will give you the idea on how to pass the parameters to your custom action and use them.