After developing the web part in Visual Studio and testing it in the development or testing environment, we need to publish the web part to the production machine.
The first thing that we need to do is copy the wsp file from the development machine to the production machine.
The wsp file is located in the bin/Debug or bin/Release directory of your Visual Studio Project.
The first steps are to copy the file and deploy it.
- Copy the file to the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN directory on your SharePoint Production Server.
- Open Command Prompt and Change the Directory using the following command: cd "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\"
- Add the solution to the SharePoint Central Administration by entering the following command:
stsadm –o addsolution –filename "webpartname.wsp" (replace webpartname.wsp with the name of your web part)
Open SharePoint Central Administration, and in the left navigation menu click on System Settings
Under Farm Management, click on Manage farm solutions.
You should now see your web part in the list of web parts. Click on your web part name .
Click on the Deploy Solution link above the web part information.
You will have the possibility to deploy this solution to a particular site or all sites under that server.
After the solution has been deployed, go to your SharePoint site:
- Make sure you are logged into the site
- Click on the Site Actions
- Click on Site Settings
- Under Site Collection Administration, click on Site collection features
- Find the web part on the list of available web parts, and click Activate.
Your web part should now be available for use on your site.