R – Moving Sharepoint project Dlls from GAC to Bin

deploymentsharepointwss

We have a Sharepoint project where we have deployed the dll's of the project to the GAC.

We have seen that the best practices is to have them in the bin directory. This is based on the information in the answer to this question: Web part dll in Gac or bin using sharepoint 2007

What are the steps that we have to do to make this change?

Thanks

Shiraz

Best Answer

Essentially two things:

This allows SharePoint's full trust assemblies to make use of those operating under partial trust (yours).

  • Write a custom Code Access Security file and add it to the web.config for the SharePoint web application.

Writing your own CAS file can be tricky and error prone if you want to do it properly. If you use a tool such as WSPBuilder it can create one automatically for you, which I strongly recommend. Otherwise, there's a written-by-hand guide here. A "cheat" method is to write a CAS file that fully trusts your assembly, but that's going against the point.

Note: Certain SP artifacts such as event handlers must be deployed to the GAC.