Reputation: 21
Wix developers!
Is it possible to specify random name for install directory name with the help of property or vbscript custom action?...
I have the following Product.wxs:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="Client">
<Component Id="ProductComponent">
<File Id="File001" Source="..\Release\One.dll" />
</Component>
...
It is prepare install directory like: C:\Program Files(x86)\Client
I need like this C:\Program Files(x86)\234wfdasdqaw where "234wfdasdqaw" random string which generated in every case when a) run msi for installation b) and if admin is not set the INSTALLLOCATION via command line.
Is it possible? thank you.
Upvotes: 2
Views: 622
Reputation: 55581
You'll need a custom action to randomly generate the string and then a type 51 (set property) custom action to set INSTALLLOCATION to a computed value if 1) it doesn't already have a value and 2) the product isn't already installed. I would not do this in the root of ProgramFilesFolder as that would be very messy. At least do it in [ProgramFilesFolder]Company or [ProgramFilesFolder]Product. Your question makes me wonder if you plan on installing this MSI more then once. Be aware that it takes special tricks to install an MSI multiple times.
Upvotes: 0