无法调试Excel加载项 [英] Can't Debug Excel Add-In

查看:134
本文介绍了无法调试Excel加载项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置开发环境,以便能够开发Excel的加载项.我遵循了一些教程,并且代码没有错误地编译,但是当我进入调试模式尝试测试我的加载项时,我总是收到下面指出的相同错误.

I'm trying to set up my development environment to be able to develop add-ins for Excel. I've followed a few tutorials and my code compiles without errors, but when I go into debug mode to try and test my add-in, I keep getting the same error noted below.

我正在Windows 7 Enterprise,Visual Studio 2010,.NET Framework 4.0上运行,正在开发Excel 2007的加载项.错误文本:

I'm running on Windows 7 Enterprise, Visual Studio 2010, .NET Framework 4.0, developing add-ins for Excel 2007. Error text:

无法加载文件或程序集'TestAddIn,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'或其依赖项之一.访问被拒绝.


**************异常文本**************
System.IO.FileLoadException:无法加载文件或程序集'TestAddIn,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'或其依赖项之一.

访问被拒绝.
文件名:"TestAddIn,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null" System.IO.FileLoadException:无法加载文件或程序集'TestAddIn,

版本= 1.0.0.0,文化=中立"或其依赖项之一.访问被拒绝.
文件名:"TestAddIn,版本= 1.0.0.0,区域性=中性"

===预绑定状态信息===
日志:用户= ACCT04 \ u90854
日志:DisplayName = TestAddIn,版本= 1.0.0.0,区域性=中性,处理器体系结构= MSIL
 (部分)
WRN:已为装配体提供了部分装订信息:
WRN:程序集名称:TestAddIn,版本= 1.0.0.0,区域性=中性,processorArchitecture = MSIL |域ID:2
WRN:当仅提供部分程序集显示名称时,发生部分绑定.
WRN:这可能会导致活页夹加载错误的程序集.
WRN:建议为程序集提供完全指定的文本标识,
WRN:由简单的名称,版本,区域性和公共密钥令牌组成.
WRN:有关此问题的更多信息和常见解决方案,请参见白皮书http://go.microsoft.com/fwlink/?LinkId=109270.
日志:Appbase = file:///C:/Users/u90854/Documents/Visual Studio 2010/Projects/TestAddIn/TestAddIn/bin/Debug/
日志:初始PrivatePath = NULL
调用程序集:(未知).
===
日志:此绑定在默认的加载上下文中启动.
日志:找不到应用程序配置文件.
日志:使用主机配置文件:
日志:使用C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config中的计算机配置文件.
日志:目前未将策略应用于引用(私有,自定义,部分或基于位置的程序集绑定).
日志:尝试下载新的URL文件:///C:/Users/u90854/Documents/Visual Studio 2010/Projects/TestAddIn/TestAddIn/bin/Debug/TestAddIn.DLL.
日志:找不到应用程序配置文件.
日志:使用主机配置文件:
日志:使用C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config中的计算机配置文件.
日志:目前未将策略应用于引用(私有,自定义,部分或基于位置的程序集绑定).
ERR:无法完成装配的设置(hr = 0x80070005).探测已终止.

  在System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,证据assemblySecurity,RuntimeAssembly locationHint,

StackCrawlMark& stackMark,布尔型throwOnFileNotFound,布尔值用于Introspection,布尔值preventSecurityChecks)
  在System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase,证据assemblySecurity,RuntimeAssembly locationHint,

StackCrawlMark& stackMark,布尔型throwOnFileNotFound,布尔值用于Introspection,布尔值preventSecurityChecks)
  在System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据assemblySecurity,StackCrawlMark& stackMark,布尔值

forIntrospection,布尔值preventSecurityChecks)
  在System.Reflection.RuntimeAssembly.InternalLoad处(String assemblyString,Evidence assemblySecurity,StackCrawlMark& stackMark,用于自省的布尔值)
  在System.Reflection.Assembly.Load(String assemblyString)
  在Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String entryPointTypeName)
  在

Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.Loa

dEntryPoints(IntPtr serviceProvider)




**************装配体**************
mscorlib
   程序集版本:4.0.0.0
    Win32版本:4.0.30319.239(RTMGDR.030319-2300)
   代码库:file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Office.Runtime
   程序集版本:10.0.0.0
    Win32版本:10.0.31119.0
   代码库:

文件:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.O

ffice.Runtime.dll
----------------------------------------
System.Core
   程序集版本:4.0.0.0
    Win32版本:4.0.30319.225内置于:RTMGDR
   代码库:file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
系统
   程序集版本:4.0.0.0
    Win32版本:4.0.30319.258建于:RTMGDR
   代码库:file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
系统配置
   程序集版本:4.0.0.0
    Win32版本:4.0.30319.1(RTMRel.030319-0100)
   代码库:file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
   程序集版本:4.0.0.0
    Win32版本:4.0.30319.225内置于:RTMGDR
   代码库:file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Security
   程序集版本:4.0.0.0
    Win32版本:4.0.30319.1(RTMRel.030319-0100)
   代码库:file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Hosting
   程序集版本:10.0.0.0
    Win32版本:10.0.31119.0
   代码库:

文件:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.T

ools.Applications.Hosting.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
   程序集版本:10.0.0.0
    Win32版本:10.0.31119.0
   代码库:

文件:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.T

ools.Applications.Runtime.dll
----------------------------------------
系统部署
   程序集版本:4.0.0.0
    Win32版本:4.0.30319.1(RTMRel.030319-0100)
   代码库: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.31119.0
   代码库:

文件:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualS

tudio.Tools.Applications.ServerDocument.dll
----------------------------------------
System.Windows.Forms
   程序集版本:4.0.0.0
    Win32版本:4.0.30319.235内置于:RTMGDR
   代码库: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.1创建人:RTMRel
   代码库: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
   代码库: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.31119.0
   代码库: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.Excel.Implementation
   程序集版本:10.0.0.0
    Win32版本:10.0.31119.0
   代码库:

文件:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Excel.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Excel.I

mplementation.dll
----------------------------------------
Microsoft.Office.Tools.Common.Implementation
   程序集版本:10.0.0.0
    Win32版本:10.0.31119.0
   代码库:

文件:///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.31119.0
   代码库:

文件:///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.Excel
   程序集版本:10.0.0.0
    Win32版本:10.0.31119.0
   代码库:

文件:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Excel/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Excel.dll
----------------------------------------

Could not load file or assembly 'TestAddIn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.


************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'TestAddIn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

Access is denied.
File name: 'TestAddIn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.IO.FileLoadException: Could not load file or assembly 'TestAddIn,

Version=1.0.0.0, Culture=neutral' or one of its dependencies. Access is denied.
File name: 'TestAddIn, Version=1.0.0.0, Culture=neutral'

=== Pre-bind state information ===
LOG: User = ACCT04\u90854
LOG: DisplayName = TestAddIn, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: TestAddIn, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/u90854/Documents/Visual Studio 2010/Projects/TestAddIn/TestAddIn/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/u90854/Documents/Visual Studio 2010/Projects/TestAddIn/TestAddIn/bin/Debug/TestAddIn.DLL.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.

   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.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.Loa

dEntryPoints(IntPtr serviceProvider)




************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.239 (RTMGDR.030319-2300)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Office.Runtime
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.31119.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.O

ffice.Runtime.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.225 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.258 built by: RTMGDR
    CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.225 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.Security
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Hosting
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.31119.0
    CodeBase:

file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.T

ools.Applications.Hosting.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.31119.0
    CodeBase:

file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.T

ools.Applications.Runtime.dll
----------------------------------------
System.Deployment
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    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.31119.0
    CodeBase:

file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualS

tudio.Tools.Applications.ServerDocument.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.235 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.1 built by: RTMRel
    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.31119.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.Excel.Implementation
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.31119.0
    CodeBase:

file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Excel.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Excel.I

mplementation.dll
----------------------------------------
Microsoft.Office.Tools.Common.Implementation
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.31119.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.31119.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.Excel
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.31119.0
    CodeBase:

file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Excel/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Excel.dll
----------------------------------------

我尝试在Google上四处寻找解决方案,但似乎没有任何效果.您能提供的任何帮助将不胜感激.谢谢!

I've tried looking around on Google for a solution and nothing seems to work. Any help you can provide would be much appreciated. Thank You!

推荐答案

打开进程监视器
open up process monitor http://technet.microsoft.com/en-us/sysinternals/bb896645 and start your excel/add-in again. Now look in process monitor for access_denied results of action - which file has it?


这篇关于无法调试Excel加载项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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