开发者

Add reference to .dll asp.net

开发者 https://www.devze.com 2023-01-31 09:45 出处:网络
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.

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?


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:

FileNotFoundException

Double check where your reference is pointing to


Have you added the DLL under references in your project so it will be included in the build?


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:

<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>
0

精彩评论

暂无评论...
验证码 换一张
取 消