Share via


Moving on with WebParticles 1

Deploying to the _app_bin folder

This post adds to Tony Rabun's post "WebParticles: Developing and Using Web User Controls WebParts in Microsoft Office SharePoint Server 2007". In the original post, the web part DLLs are deployed in the GAC. During the development period, this could become a bit of a pain as you will be doing numerous compile, deploy then test cycles. Putting the DLLs in the _app_bin folder of the SharePoint web application makes things a bit easier.

  1. Make sure the web part class that load the user control has the GUID attribute and the constructor sets the export mode to all.

Figure 1 - The web part class

 

2.   Add the AllowPartiallyTrustedCallers Attribute to the AssemblyInfo.cs file of the web part project and all other DLL projects it is referencing.

Figure 2 - Marking the assembly with AllowPartiallyTrustedCallers attribute

 

3.    Copy all the DLLs from the bin folder of the web part project to the _app_bin folder of your SharePoint web application. Make sure all the DLLs are signed.

Note: You should copy the .pdb files as well to be able to debug the user control code

Figure 3 - Bin folder for web application project referencing DLLs from other projects

Figure 4 - DLLs added to _app_bin folder of the web application

 

4.    Edit the web.config file of the SharePoint web application as follows:

5.    Add the web part assembly to the safe controls section.

Figure 5 - Adding the web part assembly to the safe controls

 

6.    Add the web part assembly to the assemblies section.

Figure 6 - Adding the web part assembly to the assemblies section

 

7.    Now create the .webpart file then add the web part to your SharePoint site web part gallery.

Figure 7 - The .webpart file

Comments