Thursday, May 31, 2012

Copying additional dlls (assemblies) to GAC with SharePoint project deployment

Frequently, we reference some external assemblies in any project event SharePoint projects as well. The need in the SharePoint project is that we may need to copy those dependent assemblies to GAC with the SharePoint project assembly.

We do not want to manually copy all the dependent assemblies to GAC by ourselves. How to copy the assemblies to the GAC with the deployment itself?

The trick is to add the reference in thePackage.package file to tell the SharePoint to copy the assemblies also to the GAC. Just edit the Package.package file in a notepad or any xml editor and add the reference just like below.


Things to Note:
  • All the assemblies to be copied to GAC needs to be signed with a strong key.
  • The "sourcepath" value is the relative path of the location of the referenced assembly
  • "SafeControl" entry may be needed based on how the control is being used. (mostly needed to be used as any UI control)

No comments:

Post a Comment