Tuesday, October 8, 2013

Webpart deployment gives error - Could not load file or assembly '' or one of its dependencies

I was trying to upgrade 2007 webpart to 2010.  I used the VS empty sp template and added my features and webpart.  I use the argotic libraries to support rss feeds.  These 3rd party dependencies had been added into the project and it compiled and deployed.  After each deployment, I would try and use the webpart and it would fail each time my part tried to hit any of those dlls.  I could not figure why this was not working.  I had the controls deployed to the GAC but was still getting the error.  Then I ran across this post (http://stackoverflow.com/questions/8406037/could-not-load-file-or-assembly-or-one-of-its-dependencies).

Solution:
Add the dependencies to the package deployment and then you are guaranteed to always have the dlls you need.  In your SharePoint 2010 project,
  1. Open Package.package from Package folder in SharePoint project.
  2. Click Advanced in bottom area.
  3. Click Add and chose which type of assembly you want to add.
  4. In dialog select dll file, chec GAC or BIN, add safe controls and class resources entries if required. Click Ok.

No comments:

Post a Comment