Deploying a web part in SharePoint.

We need to do the following to deploy the web part.

  • First we need to sign the assembly.
  • In Visual Studio right click project and select Properties.
  • In properties, select Signing Tab.
  • Select Sign the assembly check box.
  • And specify the file or create a new file.
  • Build the assembly.
  • Now the manual way of deploying the assembly would be to put it either in GAC or bin directory of the web application and put a safe control entry within the web.config of the web application.
  • However the preferred way of deploying is through a solution file, which would make our web part available in the solution management ( global configuration section) of Central administration page, from where we can deploy to multiple web applications.
  • For this we need to create a manifest file.
  • Right click the project.
  • Add New Item – Select an xml file – name it manifest.xml
  • Put the following code on the file

<?xml version=1.0 encoding=utf-8 ?>

<Solution xmlns=



                                <Assembly DeploymentTarget=WebApplication




                                                                Assembly=DeploymentWebPart, Version=, Culture=neutral,


                                                                Namespace=DeploymentWebPart TypeName=*/>







Soution ID – Create and assign a new guid.

DeploymentTarget attribute, which has two possible values: GlobalAssemblyCache or WebApplication.

 GlobalAssemblyCache indicates that the assembly should be deployed in the global assembly cache; WebApplication tells Windows SharePoint Services to drop the assembly in the private application folder of the IIS Web application

SafeControl element describes the configuration that must be done in the web.config file.

  • Now we will create the solution package, which is essentially a cabinet file that would contain our assembly and manifest file.
  • For this right click the project and select a CAB project from SetUp and Deployment projects folder.
  • Name it as DeploymentWebPartSolution
  • Right click the CAB Project and select – Add – Project Output.
  • In Project Output Group dialog box select the DeploymentWebPart and from the configuration drop down select Active.
  • In the project list box, select Primary Output to include the assembly.
  • Now again right click the cab project and select – Add – Project Output, this time select Content Files to include the manifest.xml.
  • Build the Project.
  • This will create DeploymentWebPartSolution.CAB file.
  • Rename it to DeploymentWebPartSolution.wsp
  • To add the solution package to solution store
  • Stsadm.exe -o addsolution -filename DeploymentWebPartSolution.wsp.
  • We now go to Solution Management link inside the Global Configuration section within Operations Tab of Central Administration Site.

There we will see our DeploymentWebPartSolution.wsp. Now click on it and select the web application where it should be deployed.

However if are creating our web part using web part project template within Visual studio 2008,  .wsp solution package automatically gets created for us when we select deploy command on right clicking the project. We can than make use of the .wsp file directly, no need to create a setup project in that case.


That’s it ….


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

4 thoughts on “Deploying a web part in SharePoint.”

  1. Very nice article… particularly the last paragraph, which really cleared up a question I had about WHERE in Central Administration do I deploy webparts across multiple web apps.

    More grease to your elbows, and piping hot chai in your tummy.



Share your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.