Adamon
Adamon

Reputation: 534

Install dll's to gac with WiX

I need to install Microsoft Practices enterprise library into the GAC on a production server. I have read endless articles that state the way to do this is by creating an msi with wix but I can't for the life of me figure out how it's done. Is there a way to create a simple application that references the enterprise library and installs it to the gac? Nothing else needs to be installed.

Upvotes: 2

Views: 2583

Answers (2)

Stein Åsmul
Stein Åsmul

Reputation: 42226

If only I knew the library... Let me jot down some quick options in addition to Chris Painter's answer:


NuGet: Seems to be a NuGet package here?

Dark.exe: You can also use the WiX toolkit and its dark.exe binary to decompile an existing MSI and then tweak it and compile a new MSI. The required cleanup of the WiX markup is not trivial, but possible to do. A trained packager could certainly do it. WiX Quick Start Tips.

GAC: Installing to the GAC requires a strong name for the assembly (signed) in question (more on strong naming) and then you simply set the Assembly attribute to ".net" as explained by Painter in his answer:

    <File Source="MyFile.dll" KeyPath="yes" Assembly=".net" />

Some Links: Maybe have a quick read of these links.

Upvotes: 0

Christopher Painter
Christopher Painter

Reputation: 55601

IsWiX installs GlobalParams.dll to the GAC. You can find the source code here:

https://github.com/iswix-llc/iswix/blob/master/Installer/IsWiXNewAddInMM/IsWiXNewAddInMMcustom.wxs

 <DirectoryRef Id="TARGETDIR">
      <Directory Id="GlobalAssemblyCache" Name="GlobalAssemblyCache">
        <Component Id="globalparams" Guid="{B07FF430-AAB4-49E6-8035-60142942F325}" Permanent="yes">
          <File Id="globalparams" Source="..\Deploy\IsWiXNewAddIn\GlobalParams.dll" KeyPath="yes" Assembly=".net"/>
        </Component>
      </Directory>
    </DirectoryRef>

As I recall, the directory ID doesn't really matter. Windows installer doesn't use these in terms of the GAC. The trick is 1) the DLL must have a strong name 2) The Assembly=".net" attribute will populate the proper MSIAssembly tables so that MSI will use the MsiPublishAssemblies action to interact with fusion and register the assemblies in the correct GAC.

Upvotes: 2

Related Questions