简体   繁体   中英

How to copy folder/files1..to..files5 during the installation of wix installer

I have created my installer project using WIX.I have folders and files under the project directory.I need to copy the folders and files to the installation path during the installation.

The two directory structure are 1.somefolder/file1..to file5 2.some folder/subfolder/subfile1..tosubfile5 .These two directory are inside my project directory.I need to copy the same directory inside my installation folder during the installation like this Program Files/InstallationFolder/subfolder/subfile1..tosubfile5 .

How to copy directory from project path to installation path during the installation.

This is a rather simple question with a complicated answer...

Do you have your features defined? Do you have your components defined? Do you have your Directory structure defined?

Here is what I would suggest...

<Feature id="FilesFeature" Level="1" AllowAdvertise="no">
    <ComponentRef Id="C__File1_exe"/>
    <ComponentRef ID="C__File2_dll"/>
    ....
</Feature>

<DirectoryRef ID="TARGETDIR"> //This is the director you defined somewhere else that is where you want to install to
    <Component Id="C__File1_exe" Guid={SOME_UNIQUE_GUID}">
        <File Id="__File1_exe" Name="File1.exe" KeyPath="yes" Source="{PATH_TO_YOUR_FILE}"/>
    </Component>
    <Component Id="C__File2_dll" Guid={SOME_UNIQUE_GUID}">
        <File Id="__File2_dll" Name="File2.dll" KeyPath="yes" Source="{PATH_TO_YOUR_FILE}"/>
    </Component>

    ....

</DirectoryRef>

The definitive source for information on this: http://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/add_a_file.html

A good WiX tutorials on how to do this: http://wix.tramontana.co.hu/tutorial

Specifically for the files and how to handle them: http://wix.tramontana.co.hu/tutorial/getting-started/the-files-inside

EDIT: You will want to have a directory structure defined something like this:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="SOMEFOLDER" Name="SomeFolder>
        <Directory Id="SUBFOLDER" Name="SubFolder">
        </Directory>
    </Directory>
</Directory>

Please read: http://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/add_a_file.html

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