wix 3.5 Remember Company name during folder selection
How do i get wix 3.5 to remember my company name as part of the user selected folder to be installed?
For example,
I usually install my files to C:\CompanyName and when the installer prompts user to select 开发者_StackOverflow中文版their preferred location to be installed, C:\CompanyName usualy replaced with [PATH TO USERS SELECTED FOLDER]. I would like it to add CompanyName to the end of the path.
[PATH TO USERS SELECTED FOLDER]\CompanyName
How can i achieve that?
Code below to install to C:\CompanyName
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- Install stuff into [SystemDrive] folder. -->
<!-- This is the folder where the website content will be located -->
<Directory Id="INSTALLLOCATION" Name="CompanyName">
</Directory>
</Directory>
Cheers!
You can use an extra directory to achieve your requirement
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- Install stuff into [SystemDrive] folder. -->
<!-- This is the folder where the website content will be located -->
<Directory Id="INSTALLLOCATION" Name="[User selected path]">
<Directory Id="CompanyName" Name="[Company Name]">
<!-- Put all other directory here -->
</Directory>
</Directory>
You can change the path in the custom action or through WIX property.
In custom action check whether the INSTALLLOCATION contains your company name (using simple string function string.Contains). If it does not contains the company name then append the name to INSTALLLOCATION (session["INSTALLLOCATION"] = session["INSTALLLOCATION"] + "Company Name"
)
精彩评论