Word VSTO 4.0 Addin无法加载:无法加载文件或程序集 [英] Word VSTO 4.0 Addin fails to load: Could not load file or assembly

查看:138
本文介绍了Word VSTO 4.0 Addin无法加载:无法加载文件或程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好......



简而言之就是我创建了一个Word VSTO插件,可以在很多机器上完美运行,但是没有仅在一台机器上加载。我不知道问题是在程序集名称中,还是缺少DLL。



详细说明如何完成,错误信息如下如下:



1- IDE:Microsoft Visual Studio Community 2013.



2-安装的Office版本:所有机器的2010年



3-使用的.NET框架:4.0。



4-目标机器安装了vstor_redist.exe文件。



5-安装VSTO文件的方法是将VSTO复制到程序文件中,然后运行它。这适用于所有机器,即使是那些无法加载插件的机器。



6- Addin有一个色带控件。不知道这是否对此事有任何影响。



7-开发机器:windows 7 64bit



8-试验机:windows 7 64bit。 (即使是无法加载插件的那个)



9-当组件仅为一台机器加载时我得到的错误信息是:



无法加载文件或程序集'IDMSWord2010AddinProject,Version = 4.3.0.0,Culture = neutral,PublicKeyToken = 83105d2b5774c812'或其依赖项之一。给定的程序集名称或代码库无效。 (HRESULT异常:0x80131047)



**************异常文本*********** *** System.IO.FileLoadException:无法加载文件或程序集'IDMSWord2010AddinProject,Version = 4.3.0.0,Culture = neutral,PublicKeyToken = 83105d2b5774c812'或其依赖项之一。给定的程序集名称或代码库无效。 (来自HRESULT的异常:0x80131047)文件名:'IDMSWord2010AddinProject,Version = 4.3.0.0,Culture = neutral,PublicKeyToken = 83105d2b5774c812'in System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark ,System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Evidence assemblySecurity,StackCrawlMark&System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,Evidence assemblySecurity,StackCrawlMark&stackMark,Boolean forIntrospection,Boolean suppressSecurityChecks),System.Reflection.RuntimeAssembly.InternalLoad,Boolean BooleanOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)在Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator的Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String entryPointTypeName)的System.Reflection.Assembly.Load(String assemblyString)处的stackMark,Boolean forIntrospection。 Ë xecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.LoadEntryPoints(IntPtr serviceProvider)



************* *已加载程序集************** mscorlib程序集版本:4.0.0.0 Win32版本:4.0.30319.1026(RTMGDR.030319-1000)



CodeBase:file:/// C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll



Microsoft.VisualStudio.Tools。 Office.Runtime程序集版本:10.0.0.0 Win32版本:10.0.50903.0



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL /Microsoft.VisualStudio.Tools.Office.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Runtime.dll



System.Core Assembly版本:4.0.0.0 Win32版本:4.0.30319.233内容:RTMGDR



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL /System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll



Sys tem汇编版本:4.0.0.0 Win32版本:4.0.30319.1026内容:RTMGDR



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly /GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll



Microsoft.VisualStudio.Tools.Applications.Hosting程序集版本:10.0.0.0 Win32版本: 10.0.50903.0



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting/v4 .0_10.0.0.0__b03f5f7f11d50a3a / Microsoft.VisualStudio.Tools.Applications.Hosting.dll



Microsoft.VisualStudio.Tools.Applications.Runtime程序集版本:10.0.0.0 Win32版本:10.0.50903.0



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime /v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll



System.Xml汇编版本:4.0.0.0 Win32版本:4.0。 30319.1026建筑t by:RTMGDR



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0。 0__b77a5c561934e089 / System.Xml.dll



System.Configuration程序集版本:4.0.0.0 Win32版本:4.0.30319.1015(RTMGDR.030319-1000)



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll



System.Deployment汇编版本:4.0.0.0 Win32版本:4.0.30319.1029(RTMGDR.030319-1000)



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll



Microsoft.VisualStudio.Tools.Applications.ServerDocument汇编版本:10.0.0.0 Win32版本:10.0.50903.0



CodeBase:file:/// C :/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument/v4.0_10.0.0.0__ b03f5f7f11d50a3a / Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll



System.Windows.Forms汇编版本:4.0.0.0 Win32版本:4.0.30319.1002建立者:RTMGDR



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/ System.Windows.Forms.dll



System.Drawing汇编版本:4.0.0.0 Win32版本:4.0.30319.1001建立者:RTMGDR



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll



System.Xml.Linq汇编版本:4.0.0.0 Win32版本:4.0.30319.1内置:RTMRel



CodeBase: file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll



Microsoft.Office.Tools汇编版本:10.0.0.0 Win32版本:10.0.50903.0



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.dll



Microsoft.Office.Tools.Word.Implementation程序集版本:10.0.0.0 Win32版本:10.0.50903.0



CodeBase:file:// /C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Word.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Word.Implementation.dll



Microsoft.Office.Tools.Common.Implementation程序集版本:10.0.0.0 Win32版本:10.0.50903.0



CodeBase:file: ///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Common.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.Implementation.dll



Microsoft.Office.Tools.Common汇编版本:10.0.0.0 Win32版本:10.0.50903.0



CodeBase:file: ///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Micro soft.Office.Tools.Common / v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll



Microsoft.Office.Tools.Word汇编版:10.0.0.0 Win32版本:10.0.50903.0



CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office。 Tools.Word / v4.0_10.0.0.0__b03f5f7f11d50a3a / Microsoft.Office.Tools.Word.dll



非常感谢任何帮助或建议。



您诚挚的

Hello there guys...

The issue in short is that I created a Word VSTO addin that works perfectly fine on a number of machines, but fails to load on one machine only. I don't know if the problem is in the assembly name, or there is a missing DLL.

The details of how that is done and the error message are as follows:

1- IDE: Microsoft Visual Studio Community 2013.

2- Office version installed: 2010 for all the machines

3- .NET framework used: 4.0.

4- The target machines have the file vstor_redist.exe installed.

5- The way the VSTO file is installed is through copying the VSTO into program files, then running it. This works for all the machines even the ones that fails to load the add in.

6- The Addin has a ribbon control. Don't know if that has any effect on the matter.

7- Development machine: windows 7 64bit

8- Testing machines: windows 7 64bit. (even the one that fails to load the addin)

9- The error message I am getting when the assembly loads for one machine only is:

Could not load file or assembly 'IDMSWord2010AddinProject, Version=4.3.0.0, Culture=neutral, PublicKeyToken=83105d2b5774c812' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

************** Exception Text ************** System.IO.FileLoadException: Could not load file or assembly 'IDMSWord2010AddinProject, Version=4.3.0.0, Culture=neutral, PublicKeyToken=83105d2b5774c812' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) File name: 'IDMSWord2010AddinProject, Version=4.3.0.0, Culture=neutral, PublicKeyToken=83105d2b5774c812' at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String entryPointTypeName) at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.LoadEntryPoints(IntPtr serviceProvider)

************** Loaded Assemblies ************** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1026 (RTMGDR.030319-1000)

CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

Microsoft.VisualStudio.Tools.Office.Runtime Assembly Version: 10.0.0.0 Win32 Version: 10.0.50903.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Runtime.dll

System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.233 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1026 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

Microsoft.VisualStudio.Tools.Applications.Hosting Assembly Version: 10.0.0.0 Win32 Version: 10.0.50903.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Hosting.dll

Microsoft.VisualStudio.Tools.Applications.Runtime Assembly Version: 10.0.0.0 Win32 Version: 10.0.50903.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll

System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1026 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1015 (RTMGDR.030319-1000)

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Deployment Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1029 (RTMGDR.030319-1000)

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll

Microsoft.VisualStudio.Tools.Applications.ServerDocument Assembly Version: 10.0.0.0 Win32 Version: 10.0.50903.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll

System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1002 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1001 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Xml.Linq Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll

Microsoft.Office.Tools Assembly Version: 10.0.0.0 Win32 Version: 10.0.50903.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.dll

Microsoft.Office.Tools.Word.Implementation Assembly Version: 10.0.0.0 Win32 Version: 10.0.50903.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Word.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Word.Implementation.dll

Microsoft.Office.Tools.Common.Implementation Assembly Version: 10.0.0.0 Win32 Version: 10.0.50903.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Common.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.Implementation.dll

Microsoft.Office.Tools.Common Assembly Version: 10.0.0.0 Win32 Version: 10.0.50903.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll

Microsoft.Office.Tools.Word Assembly Version: 10.0.0.0 Win32 Version: 10.0.50903.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Word/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Word.dll

Any help or advice is highly appreciated.

Yours sincerely

推荐答案

Office的架构是什么,而不是Windows。 32位还是64位?通常,Office是32位,但看起来一台机器可能有64位Office。您的加载项必须与Office的体系结构匹配,而不是Windows。
What is the architecture of Office, not Windows. 32-bit or 64-bit? Normally, Office is 32-bit but it would appear that the one machine may have 64-bit Office. Your add-in has to match the architecture of Office, not Windows.


这篇关于Word VSTO 4.0 Addin无法加载:无法加载文件或程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆