【问题标题】:How to copy folder/files1..to..files5 during the installation of wix installer如何在安装 wix 安装程序期间复制文件夹/files1..to..files5
【发布时间】:2014-11-19 15:06:18
【问题描述】:

我已经使用WIX创建了我的安装程序项目。我在项目目录下有文件夹和文件。我需要在安装过程中将文件夹和文件复制到安装路径。

两个目录结构是1.somefolder/file1..to file5 2.some folder/subfolder/subfile1..tosubfile5。这两个目录在我的项目目录中。我需要在安装过程中复制相同的目录在我的安装文件夹中像这样Program Files/InstallationFolder/subfolder/subfile1..tosubfile5

安装过程中如何将目录从项目路径复制到安装路径。

【问题讨论】:

    标签: c# visual-studio-2010 visual-studio wix


    【解决方案1】:

    这是一个相当简单的问题,但答案却很复杂......

    您是否定义了您的功能?你定义了你的组件吗?您是否定义了目录结构?

    这是我的建议......

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

    有关此信息的权威来源: http://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/add_a_file.html

    关于如何做到这一点的一个很好的 WiX 教程: http://wix.tramontana.co.hu/tutorial

    专门针对文件以及如何处理它们: http://wix.tramontana.co.hu/tutorial/getting-started/the-files-inside

    编辑: 你会希望有一个这样定义的目录结构:

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

    请阅读:http://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/add_a_file.html

    【讨论】:

    • 我需要将项目路径中的somefolder/file1..tofile2复制到我的安装目录->installationfolder/somefolder/file1..tofile2.这样可以吗。
    • 是的。 FILE 标记中的 SOURCE 属性是工具将在 MSI 输出文件中查找要捆绑的文件的位置。 “NAME”是要输出的文件的名称。 DirectoryRef 属性将是您放置文件的目录。因此,如果您希望它在安装文件夹/某个文件夹中,那么您将需要定义多个目录。
    猜你喜欢
    • 2012-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-07
    • 2012-07-06
    相关资源
    最近更新 更多