Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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!

share|improve this question

1 Answer

up vote 20 down vote accepted

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
share|improve this answer
Thank you, that worked. One follow-up question though: It appears to deploy to the GAC. Does this mean for future projects, I do not have to package the same dll's over again? – Michael Mello Feb 23 '11 at 17:14
Yes, correct. It is deployed in that project - problem is if you retract that solution, the dll is also retracted from the GAC and all your other projects will fail. So either you add it to all projects so it is always deployed - or you create a custom "Deployment" feature, which only provisions this DLL and other stuff you always want to have. – moontear Feb 23 '11 at 17:17
Excellent. Thanks again. – Michael Mello Feb 23 '11 at 18:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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