本文介绍了使用通配符/递归使用Wix复制多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Wix(以及一般的安装人员)完全是个菜鸟,所以请原谅我.

我的目标是能够遍历一个目录,搜索所有,比如说,*.exe 文件并将它们复制到预定义的目标文件夹.问题是,我知道这些文件是什么以及它们的名字,所以我不能在 wxs 文件中一一输入它们......因此是通配符.

现在,我得到了这样的结果:

...<Directory Id='TARGETDIR' Name='SourceDir'><Directory Id='ProgramFilesFolder' Name='PFiles'><Directory Id='MyDir' Name='TestProj'><Component Id='MyComponent' Guid='PUT_GUID_HERE'><CopyFile Id="CopyFiles" DestinationProperty="DESTDIR" SourceName="*.exe" SourceProperty="SRCDIR"/></组件></目录></目录></目录>...

好吧,如果我只从 SRCDIR 读取这是可以的,但是如果有子文件夹怎么办?如何查找具有特定扩展名的文件?或者还有其他方法可以做到这一点......?

安装后删除相同的文件也是一样...

非常感谢您提供的任何帮助!

解决方案

一种方法是使用 John Robbin 的命令行工具 石蜡.它会自动遍历您选择的目录并创建一个引用这些文件的 WiX 片段.Paraffin 对此非常有用,因为它支持稍后添加新文件,而无需为旧文件创建新的 GUID - 即它支持不断发展的项目.

I'm a total noob on Wix (and installers in general) so please forgive me.

My goal is to be able to traverse a directory, search for all, say, *.exe files and copy them to a predefined destination folder. Thing is, I don't know what these files are and their names so I can't type them out one by one in the wxs file... hence wildcards.

Now, I ended up with something like this:

...
<Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='MyDir' Name='TestProj'>
          <Component Id='MyComponent' Guid='PUT_GUID_HERE'>
            <CopyFile Id="CopyFiles" DestinationProperty="DESTDIR" SourceName="*.exe" SourceProperty="SRCDIR" />
          </Component>
        </Directory>
      </Directory>
</Directory>
...

Well, this is ok if I'm reading only from SRCDIR but what if there are subfolders? How do I go down looking for files with a certain extension? Or is there another way of doing this...?

Same thing with removing those same files after the installation...

Thanks a bunch for any help you can give!

解决方案

A way to do this is using John Robbin's command line tool Paraffin. It goes automatically through the directories you select and creates a WiX fragment that references these files. Paraffin is great for this since it supports adding new files later without creating new GUIDs for the old files - i.e. it supports an evolving project.

这篇关于使用通配符/递归使用Wix复制多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 23:20