visual-studio 如何排除文件被加热收集(WiX 3.5)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3734754/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:27:50  来源:igfitidea点击:

How can I exclude files from being harvested with heat (WiX 3.5)?

visual-studiodeploymentwixwix3.5heat

提问by Marcus

I would like to harvest a folder with a lot of files by using heat.exe. But instead of harvesting all files, I would like to exclude specific file extensions like "*.txt" or something like that. How can I do this?

我想使用heat.exe 来收集一个包含大量文件的文件夹。但不是收集所有文件,我想排除特定的文件扩展名,如“*.txt”或类似的东西。我怎样才能做到这一点?

回答by Yan Sklyarenko

I think the only option for now is to harvest the entire folder and apply a transform to the resulting .wxs file (see -t:<xsl>switch) to exclude what is not required (txt files in your case). However, I didn't try the 3.5 version of heat (judging based on the 3.0), but I don't think there are changes in this area.

我认为现在唯一的选择是收集整个文件夹并对生成的 .wxs 文件(请参阅-t:<xsl>开关)应用转换以排除不需要的内容(在您的情况下为 txt 文件)。不过我没试过3.5版本的heat(根据3.0来判断),不过我觉得这方面没有什么变化。

回答by Christopher Painter

I'm not a huge proponent of this pattern. How do you ensure change control when using a non-deterministic process? How do you know a file that appeared in a directory really should ship in a product and how do you know a file that vanished from the directory shouldn't break a build? How do you know you are breaking the component rules and creating servicability issues?

我不是这种模式的大力支持者。在使用非确定性流程时,您如何确保变更控制?你怎么知道出现在目录中的文件真的应该在产品中发布,你怎么知道从目录中消失的文件不应该破坏构建?您怎么知道您正在破坏组件规则并造成可服务性问题?

I used to do dynamic file linking in the 1990's because it was "easy" but I can remember it biting me many times and I haven't done it ever since.

我曾经在 1990 年代做过动态文件链接,因为它“很容易”,但我记得它让我咬了很多次,从那以后我就再也没做过。

I know Bob Arnson used to agree with this view point:

我知道 Bob Arnson 曾经同意这个观点:

http://www.mail-archive.com/[email protected]/msg03420.html

http://www.mail-archive.com/[email protected]/msg03420.html

But now in WiX 3.5 I'm starting to see capabilities that support dynamic linking and I just don't understand why they would go that way. I'd much rather update a WXS file and check it back into source control then risk putting my deployment process on autopilot.

但是现在在 WiX 3.5 中,我开始看到支持动态链接的功能,我只是不明白为什么它们会这样。我更愿意更新 WXS 文件并将其检查回源代码控制,然后冒险将我的部署过程置于自动驾驶仪上。

回答by Chris Miller

Instead of trying to figure out how to harvest selected files from of a folder, I use a before build action to populate a folder with just the files that I want harvested. The following workflow has been working for me:

我没有试图弄清楚如何从文件夹中收集选定的文件,而是使用构建前操作来仅使用我想要收集的文件填充文件夹。以下工作流程一直在对我来说有效:

  1. Delete a "files" if it exists
  2. Create a "files" folder
  3. Copy the files to the "files" folder. I use the robocopy build action, that gives me enough control to specify which files to include or exclude.
  4. Harvest the entire folder.
  1. 删除“文件”(如果存在)
  2. 创建一个“文件”文件夹
  3. 将文件复制到“files”文件夹。我使用 robocopy 构建操作,它给了我足够的控制权来指定要包含或排除的文件。
  4. 收获整个文件夹。

I have it set to run the harvest action conditionally, just for debug builds. Release builds are generated from our TFS server and use the generated .wxs from source control. It should be OK to run harvest on the build server, but it's an extra step and not having it run eliminates the "non-deterministic process" problem described by Christopher Painter. Other than that one step, the same steps execute on the build server as they do on my dev machine.

我已将其设置为有条件地运行收获操作,仅用于调试版本。发布版本是从我们的 TFS 服务器生成的,并使用从源代码管理生成的 .wxs。在构建服务器上运行收获应该没问题,但这是一个额外的步骤,不运行它会消除Christopher Painter描述的“非确定性过程”问题。除了那一步之外,在构建服务器上执行的步骤与在我的开发机器上执行的步骤相同。