Monday, January 16, 2012

Deploy DLL to Local app folder (Bin folder) in sharepoint 2010

I encouter an issue today. i need to implement a custom WebPart that wrap a custom asp.net control
that my company purchased from the third party.

if i deploy the custom WebPart to the GAC (which is by default for farm level deploy) it meams that
we had to deploy the third party DLL to the GAC as well. obviously this is a not good practice and very risky approach since we got the DLL without knowing anything as all the codes had been compile and package into the DLL.

After i google the web and found an excellent article from one of Sharepoint MVP Corey Roth

Deploying a Web Part with Code Access Security in Visual Studio 2010 (SP2010) 

I try make a very brief summary about how to solve the project DLL deployed to app folder instead of GAC (Global Assembly Cache) folder.

First we must change the assembly deployment target from GAC to WebApplication. when the project is deployed the project assembly will be deployed to the bin folder 
for my project, the DLLL is located at C:\inetpub\wwwroot\wss\VirtualDirectories\33499\bin

Second we need to add CAS (Code Access Security)Section to your solution section in the SharePoint package xml file.


finally when you compile and deploy your solution, you probably will encounter this following error
      
    Error occurred in deployment step 'Add Solution': Property set method not found.

 Microsoft already provide the hotfix  http://support.microsoft.com/kb/2022463

No comments:

Post a Comment