×

How to deploy a custom web part?

My web part projects are normally of simple c# class type and if you follow any of my web part examples, you will end up with a project dll. You will use this dll to deploy your web part. In this post I will go over how to deploy a custom we part to your SharePoint server.

Pre-Requisites:

I am assuming that you are all done with the development and are now ready to deploy. In this example I have a project name “BirthDaySystem” that I need to deploy.

Deploying the web part
  1. Build the solution
  2. If no error returned by the compiler, copy the DLL from your Birthday project bin > Debug directory to the bin directory of your WSS site (C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin).

  3. Go to (C:\inetpub\wwwroot\wss\VirtualDirectories\80\) and modify the Web.Config file for the WSS site to declare the custom web part as a safe control by adding the following code within the <SafeControls> tag.

 <SafeControl Assembly=”DLL NAME HERE” Namespace=”DLL NAME HERE” TypeName=”*” Safe=”True” />

in my case my dll name is BirthDaySystem; so my webconfig looks like the image below:

Now we can walk through, How to insert this web part in our SharePoint Page?
  1. Go to your root SharePoint site and from there Site Actions -> Site Settings -> Modify All Site Setting.

  2. Under “Galleries” tab click “Web Parts” link.

  3. Add a new web part, Click New menu in web part gallery Page.

  4. Select the newly added web part in the “New Parts Page” and click on “populate gallery”

  5. If the import is successful, you will see the web part in Web part gallery list.

Now we see How to insert into a SharePoint Page?
  1. Go to site under which you previously created the Birthday List. Go to on Site Actions > Create Page
  2. Create a blank web part page and name it BirthDayImportPage
  3. Once the page is created, click on “Add a Web Part”
  4. From the web part list, locate the one we just created and add.
Web Part Properties

This is it! Your deployment is complete. In some cases you need to setup web part properties in order for it to work. If your web part needs its properties set, then:

  1. Click on web part title bar dropdown and select “Modify Web Part”
  2. Modify Shared Web Part will bring up properties panel where you can customize your web part.

Happy Deployment!

Leave a Reply

Your email address will not be published. Required fields are marked *