0

I have a Wix-based installer with a managed (C#) CustomAction assembly. 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.

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....

The custom action build process will automatically package up any non-GAC'd assemblies that your CA depends on. "

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:

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?


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.

Community
  • 1
  • 1
John M. Wright
  • 4,291
  • 43
  • 61
  • Do you have permission to redistribute that assembly? This [question](http://stackoverflow.com/questions/10248365/is-microsoft-web-administration-dll-redistributable) indicates that it should be installed by IIS on the target it machine. – Mike Zboray Jan 14 '14 at 17:09
  • You can add reference to `Microsoft.Web.Administration.dll` as [nuget package](https://www.nuget.org/packages/Microsoft.Web.Administration/). This will include the library in the installer. – Shad Jan 14 '14 at 19:02
  • @Shad, the project reference already exists. But since the .dll is also in the GAC, the Wix tools are not including them in the CA.dll it generates. This is not solved by using the nuget package. – John M. Wright Jan 14 '14 at 19:18
  • Could you please elaborate more on the purpose of such behavior? If you need that DLL, you are going to run some code towards IIS, right? If there's no IIS, then the presence of `Microsoft.Web.Administration.dll` in your MSI won't make any difference. It sounds like you need to check IIS installation as a prerequisite... – Yan Sklyarenko Jan 14 '14 at 20:22
  • The question is more generic than the specific dll I mentioned -- there are other possible dlls where this could be an issue. – John M. Wright Jan 14 '14 at 20:45

1 Answers1

1

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. Setting it to true pulls the DLL into the built MSI and all was well.

Mouxie
  • 24
  • 2