安装时将文件从安装位置复制到 wix 中的另一个位置 [英] Copy file from setup location to another location in wix on install

查看:38
本文介绍了安装时将文件从安装位置复制到 wix 中的另一个位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 msi 安装文件,其中包含Sample"文件夹中的一些文件,这些文件应该复制到 temp 文件夹中.有人建议怎么做吗?

I have created an msi setup file which includes some files in a "Sample" folder which should be copied to a temp folder. Anybody suggest how to do this?

推荐答案

是这样的:

   <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="MyVendor" Name="MyVendor">
            <Directory Id="INSTALLDIR" Name="MyDir">
                <Component Id="MyFileId" Guid="...G1...">
                    <File Id="MyFileId" Name="MyFile" Source="...blabla...\MyFile" KeyPath="yes" >
                    </File>
                </Component>


     <DirectoryRef Id="TARGETDIR">
            <Component Id="MyFileCopyId" Guid="...G2...">
                <RemoveFile Id="MyFileRemoveId" Name="MyFile" On="install" Directory="MyCopyDir" />
                <CopyFile Id="MyFileCopyId" FileId="MyFileId" DestinationDirectory="MyCopyDir" />
            </Component>


    <Feature Id="MyFeature" ... >
            <ComponentRef Id="MyFileId" />
            <ComponentRef Id="MyFileCopyId" />

重要的 Xml 元素是 CopyFile.您需要创建一个新组件,它是第一个组件的副本(当然,具有不同的 id、guid 等).两个组件都需要在功能中声明.

The important Xml element is CopyFile. You need to create a new component that is a copy of the first one (with different ids, guids, ... of course). Both components needs to be declared in a feature.

这篇关于安装时将文件从安装位置复制到 wix 中的另一个位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆