I am quite new in creating setup project using .wxs
file in .NET project. I knew that by default when you run MSI file it creates folder with this project and it's reference files (dll, exe, etc...) in C:\Program Files (x86)
. My question is, can I change this location in my .wxs
file to another using XML.
How to change directory in wxs file where all dll and other files will be installed?
1.7k views Asked by Alex At
1
ConfigurableDirectory: You can use the
ConfigurableDirectory
attribute of the Feature Element to set a configurable feature directory. See down the page in the screenshot section here: How to assign path value to Directory in WIX?.Mock-up only:
Note: I am basing myself on the standard WiX Mondo dialog set. To hook up the Mondo dialogs, see this answer. Essentially, add reference to
WixUIExtension.dll
and insert the<UIRef Id="WixUI_Mondo" />
element. This will compile a default WiX dialog set into your MSI.Remember Property: Note that you must persist the custom directory location yourself to the registry and read back for major upgrades or else your whole product gets "moved" during upgrades (I know, it is weird). This persisting does not happen auto-magically in any way that I know about. You can persist the property and read it back using the "Remember Pattern" as described by WiX creator and benevolency Rob Mensching here: The WiX toolset's "Remember Property" pattern.
Implementation Tip: Testing the read-back of the directory property for major upgrade scenarios can be a bit fiddly. If you create a test project in Visual Studio using Votive you can use the trick to just compile version 1 of your MSI (now suffix your MSI file in the build output folder with
_Version1.0.0.msi
or similar), and then kick up one of the first three digits of the version number property and build an upgrade version (suffix with_Version2.0.0.msi
or similar). Then you install in sequence selecting a custom installation directory and check whether your second setup correctly detects the modified path. Just use a mockup or test harness project with a single component in it to get this working, or else you could drive yourself mad if you have to compile your whole setup. Then just inject your finished markup into the main project. Obvious, yes - just mentioning.Some Further Links: