View Full Version : DuplicateFile with assemblies installed to the GAC

06-16-2005, 04:48 PM
Hi !

This seems to be an old problem, maybe someone found a clean solution. I have to install the same files to the GAC and to the installation folder. I obviously don't want to include those files twice in the msi, so I tried using the DuplicateFile table, with no luck (MSI can't find the source files during installation). Here are 3 solutions I can think of:

1- At runtime, copy the installed files from the GAC to the installation folder manually (from %WINDOWS%\assembly\GAC\...)
2- Same as 1 but include and use gacutil.exe
3- Just before the DuplicateFiles action, copy the Component and File rows of the assemblies and change their Directory references so they don't install in the GAC but in a local folder. Then insert DuplicateFile rows so they use those new rows, maybe MSI will copy them properly (haven't tried it yet).

Anyone got any luck with this? I hoped that MS would have fixed this in MSI 3.1, but it doesn't seem to be the case yet... :mad:

06-17-2005, 10:37 AM
Here's another solution: I'm thinking of copying the assembly from the compressed msi instead of copying the installed file (C:\WINDOWS\assembly\GAC\MyAssemblyName\\MyAssemblyFile). But I can't find an InstallScript or MSI method to do this (extract a packaged file to a specified directory at run-time).

Anyone knows how to do this?


06-21-2005, 11:52 AM
installing to installdir and duplicating to GAC should do it.

if you try that, what are your DuplicateFile table entries?

06-27-2005, 09:09 AM
That should work, but unfortunately MSI has problems with this:

"In most cases where a setup needs to install the same file to multiple locations, you can use the DuplicateFile table. Unfortunately, the DuplicateFile table does not support installing an assembly as both a global and a private assembly. [...] After looking at a lot of different options, we decided to implement a custom action solution in .NET Framework 2.0 that would manage the installation of assemblies to both the GAC and the local file system. This allowed us to only carry a single copy of each file in the setup package and reduce the overall size of the .NET Framework setup by about 5 megabytes."

I was just wondering what is the best solution used to solve this problem (how to implement the custom action).