2

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.

Adamon
  • 484
  • 9
  • 21
  • Installing to the GAC isn't difficult provided the assembly has a strong name. You just mark it as a GAC file. Are you in a big company? Check if there is a **packaging / distribution department**, they are sure to have a package ready made? I would start from there. If not there could be existing packages online (haven't been exposed to this particular library - at least not for years). [WiX Quick Start](https://stackoverflow.com/a/25005864/129130). – Stein Åsmul Apr 08 '19 at 12:06
  • I haven't found any existing packages online unfortunately and we don't have a packaging/distribution department. An msi is available internally but that doesn't install to the GAC and no one is sure where it came from. Is there a way to make the existing msi install the DLL's to the GAC? – Adamon Apr 08 '19 at 13:01

2 Answers2

2

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.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
0

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.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164