添加对.dll asp.net的引用

时间:2010-12-21 12:49:09

标签: asp.net reference recaptcha

我有一个关于添加对.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.]
]

我缺少什么,为什么会出现此错误?

4 个答案:

答案 0 :(得分:2)

很抱歉,如果问题很愚蠢......这是你的网络项目MVC吗?似乎如果你使用基于Web表单的项目,你不应该使用该组件,因为它依赖于mvc程序集(可能有一个Web表单版本?)。

答案 1 :(得分:1)

找不到文件

这是你的理由 - 它在输出中:

FileNotFoundException

仔细检查您的引用指向的位置

答案 2 :(得分:1)

您是否在项目中的引用下添加了DLL,因此它将包含在构建中?

答案 3 :(得分:1)

对于在寻找Umbraco修复程序时发现此问题的人,可以在此处找到修复程序:

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

同样的修复程序可以应用于未运行Umbraco的网站。

总结为了节省您必须阅读整个论坛帖子,将其添加到您的网络配置:

<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>
相关问题