Troubleshooting: Assembly resolution for a managed dll from a MS-Word VSTO Add-in

3

I have an MS-Word VSTO Document with a code-behind dll named WordDocument1.dll

Project folder D:\Work\Seven\WordAutomation\ContentControls\WordDocument1\bin\Debug
I've copied some custom code into a MyAppExecs folder under that. The DLL has a private bin path specified so that code in MyAppExecs is reachable.

So on startup, I load a Starter.DLL in the MyAppExecs folder which should popup a dialog, which it does. However clicking on a button on the dialog, needs to load X.DLL, which has unmanaged dependencies. (X.DLL has some managed C++, has some libs specified as additional dependencies. X is unsigned and a private assembly, not in GAC)

X.DLL, however, cannot be resolved. From the fuslogvw tool, I see that it is attempting to load this DLL in the Office12 folder and failing. I have ProcMon running too, however, it doesn't show any unmanaged dependency file not found errors.

  • How do I make the Word Executable see the X.Dll which is present in D: \Work\Seven\WordAutomation\ContentControls\WordDocument1\bin\Debug?

Also, it seems strange that it can load Starter.DLL and a ton of others without any problems in the {ProjFolder}\MyAppExecs but can't see files in {ProjFolder}.

Here's the fuslogvw output:

*** Assembly Binder Log Entry  (12/9/2008 @ 6:10:06 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\Program Files\Microsoft Office\Office12\WINWORD.EXE
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = GEIPS-EURO\PillaiGi
LOG: DisplayName = MyNamespace.X, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5574221fffc7dcd4
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files/Microsoft Office/Office12/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: MyNamespace.X, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5574221fffc7dcd4
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Office/Office12/MyNamespace.X.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Office/Office12/MyNamespace.X/MyNamespace.X.DLL.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Office/Office12/MyNamespace.X.EXE.
LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Office/Office12/MyNamespace.X/MyNamespace.X.EXE.
LOG: All probing URLs attempted and failed.

Update#1: Solved the symptom but couldn't identify the cause of the problem. I loaded the assembly manually via an Assembly.load. However, the above assembly resolution error kept being logged and it didn't work. Finally, in a fit of desperation, I copied my word-project DLLs into {ProjFolder}\MyAppExecs such that all the DLLs were in one folder and it started working.

It looks like some unmanaged dependencies of X.dll are not being resolved when I run from the {ProjFolder}... however, ProcMon doesn't show any sign of that. Also updated the PATH variable to include {ProjFolder}\MyAppExecs, but no luck.

So copying it all into one single folder is what worked. X.dll is not my code so I couldn't probe any further.

.net
vsto
assembly-resolution
word-2007
asked on Stack Overflow Dec 9, 2008 by Gishu • edited Nov 17, 2019 by Akshay Anurag

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0