简体   繁体   English

如何在Wix托管的CustomAction程序集中包含GAC的dll?

[英]How to include a GAC'd dll in a Wix managed CustomAction assembly?

I have a Wix-based installer with a managed (C#) CustomAction assembly. 我有一个基于Wix的安装程序,具有托管(C#)CustomAction程序集。 As is described in this question , I use the Wix Visual Studio extensions to build the xx.CA.dll assembly that's included in the MSI. 本问题所述 ,我使用Wix Visual Studio扩展来构建MSI中包含的xx.CA.dll程序集。

However, as is described on Custom action project templates : 但是,如自定义操作项目模板中所述

"Building the custom action project will produce an additional DLL in the target directory with the name $(TargetName).CA.dll. That is the DLL to be streamed into your MSI Binary table.... “构建自定义操作项目将在目标目录中生成一个名为$(TargetName).CA.dll的附加DLL。这是要流式传输到MSI Binary表中的DLL。

The custom action build process will automatically package up any non-GAC'd assemblies that your CA depends on. 定制操作构建过程将自动打包您的CA依赖的任何非GAC的程序集。 "

In my case, I'm referencing a Microsoft DLL, which is in the GAC on my dev and build machines (since it is needed by the build process on those machines), but the target machines on which this MSI will be run may not have that DLL in the GAC, resulting in a runtime exception: 就我而言,我引用的是Microsoft DLL,它位于我的开发和构建计算机上的GAC中(因为这些计算机上的构建过程需要它),但是可能不会在其上运行此MSI的目标计算机在GAC中具有该DLL,从而导致运行时异常:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft...' or one of its dependencies. .

So... How do I force Wix to include a GAC'd assembly when building the .CA.dll version of my managed CustomAction assembly? 那么... 在构建托管的CustomAction程序集的.CA.dll版本时,如何强制Wix包括GAC程序集?


Edited to remove any specific dll names, since people were focusing on the dll I mentioned and not the larger question of any GAC'd dll. 进行了编辑以删除任何特定的dll名称,因为人们专注于我提到的dll,而不是任何 GAC dll的更大问题。

I had this issue until I checked the references in the project that contains the custom action. 在检查包含自定义操作的项目中的引用之前,我一直遇到这个问题。 It references 'Microsoft.Web.Administration' as you do, but CopyLocal was set to false. 它像您一样引用“ Microsoft.Web.Administration”,但是CopyLocal设置为false。 Setting it to true pulls the DLL into the built MSI and all was well. 将其设置为true会将DLL拉入内置的MSI中,一切都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM