Copying multiple files using wildcards/recursively using Wix

混江龙づ霸主 提交于 2021-02-04 22:39:08

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/3966437/copying-multiple-files-using-wildcards-recursively-using-wix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!