Deploying custom dll's in SharePoint 2010

Mike picture Mike · Feb 23, 2011 · Viewed 22.4k times · Source

I'm new to SharePoint and trying to get my head around this. I have a simple Web Part project. I also have a custom Data layer project that uses the Microsoft Enterprise Library for data access. In the Web Part project, I am adding a reference to the Data layer project's assembly. I specified in the Package of the Web Part project that I want my Data layer's assembly to be deployed. I can verify this works by using standard ADO.NET classes and not the custom MS library. If I deploy to the SharePoint server (which I have 100% access to) using the Enterprise Library, I get the error message:

"Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data"

What steps do I need to take to ensure this project and all future projects on the server can easily gain access to the Enterprise Library for data access?

Thanks!

Answer

Dennis G picture Dennis G · Feb 23, 2011

You did everything correct until a certain point: Deployment.

When deploying external DLLs, which shall also be put into the GAC or somewhere else, you need to package them with the WSP aswell. This has become very easy with Visual Studio 2010:

  1. Open your Package
  2. Click on "Advanced" (on the bottom)
  3. Add your external DLL and maybe even SafeControls for the web.config