Strengthen the installer to update the file in the GAC, regardless of version number

I have a WiX installer that needs to set new bits for Interop.FOOBARLib.DLL in the GAC. The problem is that the version number is the same as the old version, and the new bits do not write the GAC when updating. We execute the RemoveExistingProducts action after the InstallFinalize action.

We cannot transfer the RemoveExistingProducts action earlier to the installation.

The foobar.dll component is not my component, so I canโ€™t increase the type library version (which will increase the speed of interaction and all these problems will disappear).

Is there a way to get the file to be updated in the GAC, even if the version is the same? I need a behavior like "gacutil.exe / f".

The component looks like this:

<Component Id="Interop.FOOBARLib.dll" Guid="{4E0C173E-34DF-4249-A3A6-5530047FA65B}" > <File Id="Interop. FOOBARLib.dll" Name="Interop.FOOBARLib.dll" KeyPath="yes" Assembly=".net"/> </Component> 
+7
windows-installer wix
source share
3 answers

You can repair the interop assembly yourself and make it get a higher version as follows:

 tlbimp /asmversion:1.2.3 /out:Interop.FOOBARLib.DLL foobar.dll 
+1
source share

What you are trying to do is called a build update in the GAC in place. For the Interop.FOOBARLib.dll libraries to work correctly, they must have the same build version, but the new dll must have a higher version of the file. The file version attribute should be included in the new MSI MsiAssemblyName table. Wix does not include this attribute by default, so you need to add the following file to the .wixproj file:

 <SetMsiAssemblyNameFileVersion>True</SetMsiAssemblyNameFileVersion> 

See also:

In-place upgrade with Wix

+8
source share

You can try to perform an arbitrary action to delete the file right before installing the components. It is not recommended that you use vbscript for custom actions , but the example below should further illustrate the idea.

 <CustomAction Id="ForceRemove" Script="vbscript" Execute="deferred"> <![CDATA[ Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFile("c:\somefile.dll") ]]> </CustomAction> <InstallExecuteSequence> <Custom Action='ForceRemove' Before='InstallFiles'/> </InstallExecuteSequence> 
-one
source share

All Articles