user541686
user541686

Reputation: 210755

WiX -- Set Component Directory at Install Time?

The following doesn't compile, but how can I get the equivalent functionality of [MYDIR]?

<Component Id="MyComponent" Guid="MY_GUID" KeyPath="yes" Directory="[MYDIR]">
    <File Source="MyFile.dll" Name="MyFile.dll"/>
</Component>

(I'm trying to put the file MyFile.dll into a directory whose path is determined when the installer is actually run.)

Upvotes: 0

Views: 702

Answers (1)

heavyd
heavyd

Reputation: 17751

The Directory attribute must correspond to a <Directory> tag somewhere in your installer. You can set that directory to the value of a property that gets set at runtime. A good example of this is using the WixUI_InstallDir to ask the user where they want to install an application.

Here is an example of usage: https://wixtoolset.org//documentation/manual/v3/wixui/dialog_reference/wixui_installdir.html

Upvotes: 2

Related Questions