添加对 .dll asp.net 的引用
我有一个关于添加对 .NET 项目的引用的简单问题。我正在将 reCAPTCHA 添加到网站,并且我已经下载了 dll。
设置对 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.]
]
我缺少什么,为什么会收到此错误?
I have a simple question about adding references to a .NET project. I'm adding reCAPTCHA to a website and i have downloaded the dll.
After setting the reference to the dll i build and run the project and gets this error:
[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.]
]
What am i missing, why do i get this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
抱歉,如果这个问题很愚蠢……这是您的 Web 项目 MVC 吗?看来,如果您使用基于 Web 表单的项目,则不应使用该组件,因为它依赖于 mvc 程序集(也许有 Web 表单版本?)。
Sorry if the question is silly...Is it your web project MVC? It seems that If you're using web form based project you shouldn't use that component since it relies on mvc assemblies (maybe there is a web form version?).
找不到文件:
这就是你的原因 - 它在输出中:
仔细检查你的引用指向的位置
File Not Found:
This is you reason - its in the output:
Double check where your reference is pointing to
您是否已在项目的引用下添加了 DLL,以便将其包含在构建中?
Have you added the DLL under references in your project so it will be included in the build?
对于在寻找 Umbraco 修复程序时发现此问题的人,可以在此处找到修复程序:
http://our.umbraco.org/forum/developers/xslt/19383-referencing-catcha-dll-breaks-xslt
相同的修复可以应用于不支持的网站运行乌布拉科。
摘要为了让您不必阅读整个论坛帖子,请将其添加到您的网络配置中:
For people finding this whilst searching for a fix for Umbraco, the fix can be found here:
http://our.umbraco.org/forum/developers/xslt/19383-referencing-catcha-dll-breaks-xslt
The same fix can be applied to websites that are not running Umbraco.
Summary to save you having to read the whole forum post, add this to your web config: