The assembly <assemblyname> could not be found at <path> or could not be loaded.

 I was installing a managed Office application on a client's machine. I had gone through all the cumbersome steps to setup the security to work from a network share, etc., etc..  I kept getting the following error:

Assembly Cannot Be Found
This causes the following error message:
The assembly <assemblyname> could not be found at <path> or could not be loaded.
You can still edit and save the document. Contact your administrator or the author of this document for further assistance.

I did some digging around on Microsoft's VSTO Troubleshooting Page , and found this: 


Assembly Cannot Be Found
This causes the following error message:
The assembly <assemblyname> could not be found at <path> or could not be loaded.
You can still edit and save the document. Contact your administrator or the author of this document for further assistance.

There are a number reasons that this error could occur:

  • Check that the user has access to the assembly location and that the named assembly exists. For more information, see Assemblies in Office Projects.
  • You might have changed the name of your assembly (which is used as the project namespace by default) or the name of the class (by default named OfficeCodeBehind). If you do this, you must manually update the Office integration attribute in the project template code to use the new names and then recompile your solution. Specifically, you must change the Class=<namespace>.<classname> statement:
    <Assembly: System.ComponentModel.DescriptionAttribute( "OfficeStartupClass, Version=1.0, Class=<namespace>.<classname>")>
  • If this error is raised by a document that was created from a template, the path to the assembly might still be the relative path from the template. When you create a document from a Word template, by default the path in the custom property _AssemblyLocation0 is relative to the original template. If the user saves the document in a different location, the document will not find the assembly unless the assembly is copied to the new relative location.

    For information on changing the assembly path manually, see How to: Link an Assembly to a Word or Excel File. For a code example that changes the property from relative to absolute, see Code: Change the Assembly Path from Relative to Absolute in a Document (Visual Basic), or Code: Change the Assembly Path from Relative to Absolute in a Document (C#).

    For information on the custom properties, see Word and Excel Project Properties


Allow me to add to this list one more problem that can cause this error:  the target machine does not have the Office 2003 PIA's installed.  This is not documented anywhere that I can find, so I post it here.

Cheers!

Comments

# re: The assembly <assemblyname> could not be found at <path> or could not be loaded.

Thursday, September 30, 2004 6:40 AM by Tristan Fletcher

I have created an excel file with the appropriate assembly which works fine if the assembly is located anywhere on my PC but not if the assembly is on a network with the excel file located locally. I have gone through everything I can think of, including all the solutions you have listed, but I still get the same error. Any ideas????

# re: The assembly <assemblyname> could not be found at <path> or could not be loaded.

Thursday, September 30, 2004 11:31 PM by Chris McKenzie

1) The permission set for an assembly must be set up under Machine->All Code->LocalIntranet_Zone.

2) The _AssemblyLocation0 Document property must be give the fully qualified network path to the Assembly.

You Should be able to run caspol.exe -rsg <Full path to Assembly> and see if there is some other permission set that is keeping the code from executing.

Caspol.exe is located at <system>\Microsoft.NET\Framework\v1.1.4322.

If this doesn't work, reply to this comment with more details about your project.

# re: The assembly <assemblyname> could not be found at <path> or could not be loaded.

Wednesday, October 20, 2004 2:10 PM by Harry Nystrom

I am having a similar problem with a WORD template, and have addressed both the assembly name and the caspol issues. Still I get the error. Any other ideas?

Thanks in advance.

Leave a Comment

(required) 
(required) 
(optional)
(required)