Friday, 26 November 2010

How to fix the "Could not load file or assembly" error

Say you want to use a third party dll in your project.
You have made a reference to the dll in your VS project, and mayby even included it in your project in a folder. However you are still getting the error: "Could not load file or assembly .... or one of its dependencies. The system can not find the file specified."


The solution to the problem is relatively simple.
You have to include the dll file in the package so it get deployed to SharePoint with the rest of your solution.



Here it goes..
  1. Double click "Package" in the Solution Explorer
  2. Click "Advanced" in the lower left corner of the package designer.
  3. Click the "Add" button in the upper right corner, and choose "Add Existing Assembly".
  4. In "Source Path" click the "..." button and navigate to your dll assembly.
  5. Lastly choose "Global Assembly Cache" as your "Deployment Target".

No comments:

Post a Comment