R – Can a .NET Word 2003 add-in be installed outside of the GAC

gacms-wordnet

I've created a Word add-in component, and a visual studio setup project to install the component.

On a clean machine with Office 2003 installed, it does not seem to be possible to get the add-in component to load in Word.

Googling the issue suggests that this is because the assembly is not trusted. I gave the assembly full trust using the command line tool:

caspol -af AssemblyName.dll

This makes no difference and the compenent is still not loaded in Word. caspol prints out a message "Because all GAC assemblies always get full trust, the full trust list is no
longer meaningful. You should install any assemblies that are used in security
policy in the GAC to ensure they are trusted"

Changing the installer to put the assembly in the GAC allows it to correctly load in Word. But the component may have to use common assemblies in the future, shared between our other .NET applications, and adding these libraries to the GAC would be undesirable.

Does anyone know how to set the security to allow the component to be loaded when installed outside the GAC?

Best Answer

You can manually run the following command to set security to allow the word to run the assembly from outside the GAC. This creates a new group with full trust which is what allows the assembly to run.

caspol.exe -u -addgroup All_Code -url "\*"  FullTrust -n AssemblyName.dll

Microsoft have an example custom action for an installer at the following site link to MSDN, which will allow you to include this command as an installer custom action.