This articles discusses on how to deploy WebParts. There are two ways to deploy a Webpart. Here, we try to enlist the steps involved.
Step 1: Move the Assembly (dll) in to GAC (C:\WINDOWS\assembly)
Step 2 : Add cab/setup project for the deployment
How to Create and Deploy Class Library Project Webpart
1. Create a Class Library project.
2. Add the following references
Microsoft.Sharepoint System.Data System.Web
3. Rename the Project as well as class files.
4. Use the following namespaces in the class file
using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts;
5. Inherit WebPart in the class file
6. Now right click on project file and select properties and select/create strong name.
7. Compile the application.
8. Now find the Assembly (dll) in the bin folder.
9. Move the assembly in to the GAC. GAC availbale in the C:\WINDOWS\assembly path.
10. Add the below code in the web.config for the particular webpage. This code should be placed in the SafeControls tag. Right click on the assembly in the GAC to copy PublicKeyToken number.
SafeControl Assembly="ClassLibrary_WP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=13638a1282740f9f" Namespace="ClassLibrary_WP" TypeName="*" Safe="True"
11. Use iisreset\ noforce to refresh the web page.
12. Open SPS site, click on site Actions -> Site Settings -> Click on Webparts -> Click New -> Select your webpart
|
No responses found. Be the first to respond and make money from revenue sharing program.
|