0

I'm developing a webpart that contains a form for register data and send it to a list.

I know a little about Sharepoint webpart development but again, implementation of external resources in SharePoint customizable webparts (not even the development using SPListItems, SPQuery, etc) still produces me headaches...

I'm trying add recaptcha control in this webpart form, but after the deployment I check the form in runtime and I get this error:

Parser Error Message: Could not load file or assembly 'Recaptcha, Version=1.0.5.0, PublicKeyToken=9afc4d65b28c38c2' or one of its dependencies. The system cannot find the file specified.

The full error that shows me the Elements tab in Google Chromes says:

[FileNotFoundException]: Could not load file or assembly 'Recaptcha, Version=1.0.5.0, PublicKeyToken=9afc4d65b28c38c2' or one of its dependencies. The system cannot find the file specified. at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at System.Web.Configuration.CompilationSection.LoadAssembly(String assemblyName, Boolean throwOnFail) at System.Web.UI.TemplateParser.AddAssemblyDependency(String assemblyName, Boolean addDependentAssemblies) at System.Web.UI.MainTagNameToTypeMapper.ProcessTagNamespaceRegistrationCore(TagNamespaceRegisterEntry nsRegisterEntry) at System.Web.UI.BaseTemplateParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) [HttpParseException]: Could not load file or assembly 'Recaptcha, Version=1.0.5.0, PublicKeyToken=9afc4d65b28c38c2' or one of its dependencies. The system cannot find the file specified. at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) [HttpParseException]: Could not load file or assembly 'Recaptcha, Version=1.0.5.0, PublicKeyToken=9afc4d65b28c38c2' or one of its dependencies. The system cannot find the file specified. at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at Glogic.FormLiberty.FormLiberty.FormLiberty.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The steps I follow for add the dll in GAC and SharePoint project are:

  • Register the dll in GAC using Visual Studio Command Prompt.
  • Add the dll directly in /bin folder.
  • Add the dll in the Package folder following the steps described in this answer.
  • Check in the manifest.xml file if the dll is already registered.

In this link says that the recaptcha.dll must be added in a SafeControl tag instead in a Assembly tag:

I haven't the log files. In resumen, the main problem is:

Could not load file or assembly or one of its dependencies. The system cannot find the file specified.

I downloaded the recaptcha.dll here

  • First of all you should check Fusion log to see folder locations where .NET Framework is searching for the target assembly: msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx – Slaven Semper Nov 27 '14 at 22:02
  • @SlavenSemper I'm trying to see how it works, but unfortunately I'm still searching more results and re-installing the .dll doesn't show changes... maybe the dll isn't added correctly. – Mauricio Arias Olave Nov 27 '14 at 22:19
0

The DLL you are trying to add is most likely a 32-bit DLL. SharePoint development is done in 64-bit and thus it is not possible to use that DLL in your application.

That also explains why SharePoint is not able to load your DLL since you only have the 32-bit DLL installed in your GAC after deployment.

  • You're right. After search and test this code provided in this answer the recaptcha.dll is I386, AFAIK that means 32-bit for recaptcha.dll. I'm considering mark your answer as accepted, but before, can you (or anyone else) can guide about what else I can do for implement recaptcha in SharePoint? – Mauricio Arias Olave Nov 28 '14 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.