Append ProductName into INSTALLLOCATION

2019-09-19 04:01发布

问题:

I want to append ProductName in the end of _BrowseProperty. Like a:

<Publish Event="SetTargetPath" Value="[_BrowseProperty][ProductName]">1</Publish>

But this is the wrong approach, and so it is impossible. I found this advice, bit it is dirty, really. I want to substitute ProductName as this happened in notepad++ installer (I change "C:\", press "ok" and INSTALLLOCATION:=C:\[ProducName]). Also I wanted to change BrowseDlg and directory tree (cause the default DirectoryList/DirectoryCombo is so poor-looking)), but there is no other not-hurt variant besides the standard in WIX [ref].

May be anything changed recently?

回答1:

I'm not sure of the order in which want to do this, but if you want to show the user the default directory containing the product name then you append [ProductName] to the install folder. Typically there is a type 51 custom action to set the default location - you may already have one that sets the default install folder to something like:

[ProgramFilesFolder][Manufacturer][ProductName]

and the user can change that if they want. The default install folder might be INSTALLDIR. Although I wouldn't recommend changing what the user specifies, you'd do that with a type 51 custom action after the user has chosen the folder, so you'd basically change INSTALLDIR to be INSTALLDIR[ProductName] after INSTALLDIR has been set by the browse dialog.

So this all depends on what you have already done to set a default install location, if anything, also whether you want to change what the user specifies, and how you may want to deal with a silent install when there is no browse dialog (which is why there is typically a type 51 CA to set a default).