2010-12-21 64 views
1

我有一个关于添加对.NET项目引用的简单问题。我将reCAPTCHA添加到网站,并且我已经下载了该dll。添加对.dll的引用asp.net

设置参考DLL我建立并运行该项目,并得到这个错误后:

[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.] 
    System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) +0 
    System.Reflection.Assembly.GetTypes() +96 
    StarSuite.Core.Settings.GetSingletonInstancesOfBaseType(Type baseType, String staticMethodName, Type returnType) +149 

[ApplicationException: Unable to load types from 'Recaptcha, Version=1.0.5.0, Culture=neutral, PublicKeyToken=9afc4d65b28c38c2'. LoaderExceptions: [FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.] 
] 

我失去了什么,为什么我得到这个错误?

回答

2

对不起,如果问题是愚蠢的...它是你的web项目MVC?看起来如果你使用的是基于web表单的项目,你不应该使用这个组件,因为它依赖于mvc程序集(也许有一个web表单版本?)。

+0

不,它不是一个MVC项目。我有错误的DLL? – Andy 2010-12-21 13:04:53

+0

我还没有使用过这个组件,但是我想说你应该在谷歌代码上检查这个项目http://code.google.com/apis/recaptcha/docs/aspnet.html – 2010-12-21 13:11:39

+0

我尝试了一个老版本的组件我接缝工作!非常感谢您的帮助和时间! – Andy 2010-12-21 13:14:11

1

找不到文件

这是你的原因 - 它的输出:

FileNotFoundException 

在您参考指向

+0

但我已清楚该文件,浏览到它时,我添加引用? – Andy 2010-12-21 12:51:22

+0

你可以看看引用属性,并发布它的路径是什么,探索者说它的路径是什么? – 2010-12-21 12:52:33

+1

尝试检查文件权限 – 2010-12-21 12:52:54

1

仔细检查你有没有下引用添加DLL在你的项目中,所以它会包含在构建中?

+0

我在项目中没有参考文件夹? – Andy 2010-12-21 13:02:22

+0

我正在讨论Visual Studio中解决方案资源管理器中的参考文件夹。 – StefanE 2010-12-21 13:36:17

1

对于人们找到这个搜索的同时为一把umbraco修复,修复可以在这里找到:

http://our.umbraco.org/forum/developers/xslt/19383-referencing-catcha-dll-breaks-xslt

相同的修订可以应用到没有运行的一把umbraco网站。

总结,以节省您不必读取整个论坛上发帖,将它添加到您的web配置:

<runtime> 
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
      <dependentAssembly> 
       <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> 
       <bindingRedirect oldVersion="1.0.0.0" 
      newVersion="2.0.0.0"/> 
      </dependentAssembly> 
     </assemblyBinding> 
    </runtime>