Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Additional info about installing an assembly to the GAC and the local file system

Additional info about installing an assembly to the GAC and the local file system

  • Comments 2

I wrote this post a couple of months ago describing how to install an assembly to both the GAC and the local file system in the same MSI.  Since then, I've been asked a couple of follow-up questions by folks who read my blog post and also by internal Microsoft setup developers.  Here is an interesting question that I wanted to share.  I helped out a developer who is using WiX to create their MSI.  They initially created a single component with 2 copies of the file but the MSI could not be created.  This is because Windows Installer does not allow you to install multiple assemblies in the same component (except in the rare case that you have a multi-module assembly).  The developer then followed the guidelines of creating 2 separate components to install the file - one for the local file system and one for the GAC.  The snippet of their WiX XML looks like this:

<Component Id="foo.dll" Guid="23C421A5-B2AA-415b-9359-B3CC2F46D155" DiskId="1">
  <File
    Id="foo.dll" KeyPath="yes"
    Name="foo.DLL" LongName="foo.dll"
    src="$(var.FileRoot)\foo.dll"
  />
</Component>
<Component Id="foo_GAC.dll" Guid="73205F15-F5D9-4EAE-A442-025B06B1ECBF" DiskId="1">
  <File
    Id="foo_GAC.dll" KeyPath="yes" Assembly=".net" ProcessorArchitecture="msil"
    Name="foo.dll" LongName="foo.dll"
    src="$(var.FileRoot)\foo.dll"
  />
</Component>

However, when the developer ran ICE validation on the resultant MSI, it came up with the following errors:

ICE30   ERROR The target file 'foo.dll|foo.dll' is installed in '[ProgramFilesFolder]My Folder\' by two different components on an LFN system: 'foo_GAC.dll.77A12173_4086_4E29_AEFF_562F22878D9A' and 'foo.dll.77A12173_4086_4E29_AEFF_562F22878D9A'. This breaks component reference counting.
ICE30   ERROR The target file 'foo.dll|foo.dll' is installed in '[ProgramFilesFolder]My Folder\' by two different components on an LFN system: 'foo_GAC.dll.77A12173_4086_4E29_AEFF_562F22878D9A' and 'foo.dll.77A12173_4086_4E29_AEFF_562F22878D9A'. This breaks component reference counting.

The problem ended up being that both components were authored to install to the same directory, which is a little misleading since the copy of the file that gets installed to the GAC does not actually get installed to the directory listed in the Component table of the MSI.  The way that the Visual Studio MSI package handles this is to create a dummy directory named \GAC underneath the local directory that each duplicated assembly is installed to on the local file system.  Then the GAC version of the component can be marked to "install" to that dummy directory, which will allow the ICE30 test to pass.

 

  • In your example I see you give the GUID of 77A12173_4086_4E29_AEFF_562F22878D9A as part of the validation error. I don't see this GUID in the WiX sample. I do notice it's the Merge Module GUID used in Monad though. Are you workin on Monad?

  • Hi Christopher - I actually pulled this GUID from an email thread I was on with another person who requested help trying to install an assembly to both the GAC and the local file system. It is intended only as a sample of the type of error messages you might see while performing ICE validation, but the GUIDs themselves will vary depending on the setup package you are working on.

    If you are having any specific problems getting this strategy for installing assemblies to work in your setup, please contact me via http://blogs.msdn.com/astebner/contact.aspx and let me know and I can try to help.
Page 1 of 1 (2 items)
Leave a Comment
  • Please add 3 and 1 and type the answer here:
  • Post