安装时将文件从安装位置复制到 wix 中的另一个位置

发布于 2024-10-05 20:46:51 字数 97 浏览 0 评论 0原文

我创建了一个 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甲如呢乙后呢 2024-10-12 20:46:51

类似这样:

   <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……)。这两个组件都需要在功能中声明。

Something like 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" />

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.

朕就是辣么酷 2024-10-12 20:46:51

CopyFile 元素是你的朋友。您可以将其多次嵌套在原始 File 元素下,具体取决于方式很多时候你需要复制它。放置正确的目标文件夹,然后让 Windows Installer 完成其余的工作。

CopyFile element is your friend. You can nest it under the original File element a number of times, depending on how many times you need to copy it. Put the correct destination folder(s) and let Windows Installer do the rest.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文