包括MSI中文件夹中的所有文件

人气:657 发布:2022-09-22 标签: visual-studio

问题描述

如何在源文件夹中包含所有文件并在安装期间将它们部署到目标文件夹中。我在一个文件夹中有多个图像,我希望所有这些图像都自动包含在msi中,而不是使用

 <   file  >   

元素。我能够使用

 < 包含所需的dll和文件组件    Id   ='  HelperLibrary' >   <  文件    Id   ='  HelperDLL'   名称  ='  Helper.dll'    /  >   <   / Component  >  

我们将不胜感激任何帮助。

解决方案

据我所知,Wix项目架构中没有这样的功能。应明确列出所有文件。 WiX方法不同。它具有从目录,站点和其他来源收集数据的概念。这是通过名为heat的实用程序完成的: http://wixtoolset.org/documentation/manual/v3 /overview/heat.html [ ^ ]。 现在,如果这个文件Helper.dll是你自己的带有源代码的组件,你应该做完全不同的事情。您应该将此项目包含在与WiX项目相同的解决方案中,并使用通常的添加参考通过WiX项目引用帮助程序项目。然后,您可以通过项目名称间接引用此文件,从而从DLL或EXE文件的位置和名称中抽象出来。例如:

 <  组件    Id   =  Assemblies    Guid   =  ...某些GUID ... >   < span class =code-keyword><  文件    Source   =  

(var.Product .TargetPath) Id = entryPointAssembly / > < 文件 来源 =

(var.Help.TargetPath) Id = Help.dll / > < 档案 来源 =

How can I to include all files from source folder and deploy them into a target folder during installation. I have multiple images in a folder and i want all of them to be included in msi automatically rather than including all of them separately using

<file>

element. I am able to include required dlls and files using

<Component Id='HelperLibrary'>
        <File Id='HelperDLL' Name='Helper.dll' />
</Component>

Any help will be appreciated.

解决方案

To best of my knowledge, there is no such feature in the Wix project schema. All files should be explicitly listed. The WiX approach is different. It has the concept of "harvesting" of the data from directories, sites and other sources. This is done through the utility called "heat": http://wixtoolset.org/documentation/manual/v3/overview/heat.html[^]. Now, if this file, "Helper.dll", is your own component with source code, you should do completely different thing. You should include this project in the same solution as your WiX project and reference the "Helper" project by your WiX project using the usual "Add Reference". Then you can reference this file indirectly, by the name of the project, thus abstracting from the location and name of the DLL or EXE file. For example:

<Component Id="Assemblies" Guid="... some GUID ...">
    <File Source="

(var.Product.TargetPath)" Id="entryPointAssembly"/> <File Source="

(var.Help.TargetPath)" Id="Help.dll"/> <File Source="

782