问题描述
我正在使用Wix Toolset 3.8 Visual Studio加载项.我创建了一个WIX安装程序库,其中封装了一些公共组件,这些组件将由各种服务部署项目使用.该库包含对多个解决方案文件的引用,这些文件需要打包到每个部署中.
I am using the Wix Toolset 3.8 Visual Studio add-in. I have created a WIX Setup Library which encapsulates some common components that will be consumed by various service deployment projects. This library includes references to several solution files which need to be packaged into each deployment.
在我的wix库片段中使用了几种不同的方式来使用这些依赖项.例如:
These dependencies are used in my wix library fragments in a few different ways. For example:
<Binary Id="InstallationScript" SourceFile=".\Dependency1.vbs" />
<CustomAction Id="DependencyAction"
BinaryKey="InstallationScript"
VBScriptCall=""
Execute="deferred"
Return="check"
HideTarget="no"/>
<Component Id="DLL_Component" Guid="4745D9E2-0EBA-EE57-D8DB-677ADA9E9EC8">
<File Id="DLL1" Name="Dependency1.DLL" Source=".\Dependency1.dll" Vital="yes" KeyPath="yes" DiskId="1"/>
</Component>
无论是将文件作为链接添加到项目中还是将它们复制到项目目录中,以及是否在项目目录中引用它们还是使用相对路径到原始位置,WIX安装程序库都可以很好地构建.当我将片段包含在WIX安装项目中以进行服务部署时,就会出现问题.
The WIX Setup Library builds fine whether I add the files to the project as a link or copy them into the project directory, and whether I reference them in the project directory or use a relative path to their original location. The problem comes when I include the fragment in my WIX Setup Project for my service deployment.
<Custom Action="DependencyAction" Before="InstallFinalize">
NOT INSTALLED AND NOT UPGRADINGPRODUCTCODE
</Custom>
安装项目在文件夹结构中的相对深度不同,因此相对路径不会指向从WIX库引用时指向的相同位置.当我从WIX库引用动作或功能时,会出现类似The system cannot fine the file '.\Dependency1.dll'
之类的错误消息:XML的读取方式完全相同,并且是从安装项目位置而不是从库项目位置引用的,因此相对目录是错误的.我可以将WIX库中的相对路径设置为使用它的安装项目的相对路径,或者也可以将解决方案文件复制到安装项目的目录中,但是当然,这完全违背了使用AIX的目的.通用的WIX库.还有其他服务部署项目需要使用此库.
The Setup Project is not at the same relative depth in the folder structure, so a relative path does not point to the same place as it does when referenced from the WIX Library. When I reference the action or feature from the WIX library I get errors like The system cannot fine the file '.\Dependency1.dll'
The XML is being read exactly as it is and referenced from the Setup Project location rather than from the Library Project location, so the relative directory is wrong. I can set the relative path in the WIX library to what it should be for the Setup Project that consumes it, or I can copy the solution files into the Setup Project directory as well, but of course, that completely defeats the purpose of using a common WIX library. There are other service deployment projects that need to consume this library.
问题是,无论安装项目所在的目录如何,如何以使用WIX库的方式引用解决方案文件,即可由使用它的安装项目使用?
So the question is, how do I reference solution files in a WIX library in a way that can be used by the Setup Project that consumes it, regardless of the directory that the Setup Project is in?
推荐答案
创建一个二进制.wixlib,其中包含创作中引用的文件. (在命令行中为-bf,在.wixproj中为BindFiles属性,在Votive中为将文件绑定到库文件中"复选框.)
Create a binary .wixlib that contains the files referenced in your authoring. (That's -bf at the command line, BindFiles property in the .wixproj, "Bind files into the library file" checkbox in Votive.)
这篇关于如何通过WIX安装程序库维护文件引用的完整性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!