简体   繁体   中英

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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