How to remove WordWriter from the Global Assembly Cache

Problem

In OfficeWriter version 4.6.0 and below, the installer placed WordWriter in the Global Assembly Cache (GAC). This was to enable you to use WordWriter in a COM application, via a COM-Callable Wrapper. However, if you are not using WordWriter in COM or if you prefer not to have assemblies in the GAC, you may wish to remove WordWriter from the GAC.

Solution

General WordWriter uninstallation instructions can be found in our documentation.

To manage assemblies in the GAC, you can use the gacutil tool. The availability of this tool depends on the version of the .NET framework. You can find gacutil at the following locations:

  • For .NET 1.1: c:\Windows\Microsoft.NET\Framework\v1.1.xxxx
  • For .NET 2.0 through 3.5: c:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin
  • For .NET 4.0: c:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools

On an x64 system, substitute Program Files (x86) for Program Files. The version of gacutil matches the version of the .NET framework. To see the version of gacutil, simply enter gacutil with no arguments at the command line.

If you do not already have gacutil, you may need to install required packages. For .NET 1.1, gacutil is bundled with the framework. For .NET 2.0 through 3.5, you should install the Microsoft Windows SDK for .NET Framework 3.5, of which there are different downloads depending on your operating system. For .NET 4.0, you should additionally install Visual Studio 2010. If you do not want to install the SDK or Visual Studio, such as in production, you can install it on a different system and simply copy gacutil.exe.

WordWriter 3.x uses .NET 1.1 while WordWriter 4.x and higher uses .NET 2.0. You should use a version of gacutil at least as high as the .NET version required by WordWriter. Specifically, use gacutil version 1.1 or higher for WordWriter 3.x and gacutil version 2.0 or higher for WordWriter 4.x.

To uninstall WordWriter from the GAC:

1. Determine the full strong name of the WordWriter assembly:

 gacutil /lr SoftArtisans.OfficeWriter.WordWriter 

There may be multiple versions of WordWriter in the GAC. Note the full name of the assembly you want to remove; for example, SoftArtisans.OfficeWriter.WordWriter, Version=4.5.1.1641, Culture=neutral, PublicKeyToken=f593502af6ee46ae.

2. If you are using WordWriter in a web application, reset IIS to make sure the assembly is not being used. Remove the assembly from the GAC (note the use of quotes around the assembly’s full name):

 gacutil /uf "SoftArtisans.OfficeWriter.WordWriter, Version=4.5.1.1641, Culture=neutral, PublicKeyToken=f593502af6ee46ae" 

However, you may find that gacutil does not succeed due to the following error: “Assembly could not be uninstalled because it is required by Windows Installer.” In this case, follow the steps described in this Microsoft knowledge base article. In particular, open the Registry Editor, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Assemblies\Global and remove the reference to the WordWriter assembly above. Doing so means that the Windows installer no longer attempts to remove WordWriter from the GAC during automatic uninstallation, but otherwise the uninstallation process is unaffected.

If your web application references a WordWriter assembly that has been removed from the GAC, be sure to update the reference to point to another copy of the WordWriter assembly.

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *