0
votes

I'm developing a webpart in Sharepoint 2013 using VS2012. In this webpart I'm using a custom dll that I created. The library framework is 4.0 and the visual webpart framework is 4.5.

The problem is when I'm adding the webpart in sharepoint page, the following error appeared:

Could not load file or assembly 'RulesDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d2371e81bc184aa5' or one of its dependencies. The system cannot find the file specified

Searching in google I found a lot of solutions to resolve this problem

  • Adding library to GAC using two methods.

    (1) gacutil -i RulesDll.dll

    (2) Using package ---> Advanced options in the solution explorer in VS2012

enter image description here

When I running gacutil -l RulesDll in VS command prompt everything sames to work:

Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.17929
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  RulesDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d2371e81bc184aa5,    processorArchitecture=x86

Number of items = 1

So the library is in the GAC.

  • Adding the library to the save control in web.config

But nothing works. Does someone know why it's impossible to add my own webpart in a sharepoint page?

2

2 Answers

0
votes

What's the error you get once your assembly is in GAC and you try to add the webpart on the page?

Check the web.config of your application and especially the SafeControls section, there should be a reference to your assembly.

http://technet.microsoft.com/en-us/library/cc261736.aspx

0
votes

Finally found the error. All libraries must be deploy in x64