简体   繁体   中英

How to Create Installer For EXE Files With Multiple Destination Path for files

I have one small requirement.I have to create one installer which would deploy (paste embedded txt and config files) file to different locations

Situation

  1. At the start of installation ,it should ask for Main installation path.Or there should be provision to pick that path from some Autorun or Ini file
  2. Selected path will have different destination folder.Installation utility should deploy file to their destination folders.Eg file1 should go to \\File_Conf folder...File2 should go to \\business_Rules folder

I have found one interesting tool WIX .I am still digging into details of it. Does anyone has worked on same requirement any hint would be okay. As per my understanding we cannot embed custom script in VS Setup project. InstallSheild isgood for it but it is licensed.

I think you can keep all the files & configuration file in one temporary directory in application directory and you can add custom action installer by which you can move the files to required directory from temp directory based on the config/ini file. At the end of installation you can delete the temp directory. From my hope this could be the solution.There could be some other optimized way of doing this.I did'nt get time to explain with code.

You can do this by defining different Directories and then referring to them in your "Component list". You'll probably need to provide a GUI in which the user can define his/her INSTALLFOLDER for the separate component (in this case DOCUMENTATION).

If you need more info, let me know.

<Directory Id="ProgramFilesFolder">
                <Directory Id="FirstSubFolder" Name="First Sub Folder">
                    <Directory Id="SecondSubFolder" Name="Second Sub Folder">
                        <Directory Id="DOCUMENTATIONFOLDER" Name="Documentation" ComponentGuidGenerationSeed="a9f690d3-22b3-488f-bdac-bb665c25933c"/>
                    </Directory>
                </Directory>
            </Directory>

In my case we created separate .wxs files (created by heat). The Component and File elements are less important than the structure (Directory < Component < File).

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="DOCUMENTATIONFOLDER">
            <Component Id="File.pdf" Guid="*">
                <File Id="File.pdf" KeyPath="yes" Source="$(var.gatheredDocumentation)\File.pdf" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="DocumentationComponents">
            <ComponentRef Id="File.pdf" />
        </ComponentGroup>
    </Fragment>
</Wix>

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