简体   繁体   中英

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 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" )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM