Recently, I was working on a suite of web parts for a client. Everything was proceeding fantastically until I needed to deploy my farm solution (containing many web parts) from my development server to another SharePoint server for demonstration purposes. Visual Studio 2010 provides outstanding functionality for creating Web Parts for SharePoint, and can deploy them locally (provided that SharePoint is installed locally), but it cannot deploy them to a different remote server.
Naturally I did what all professional software engineers do when presented with a puzzling quandary such as this, I Googled it. After all, in the immortal words of Pablo Picasso “Good artists create, great artists steal.” So, upon searching, I stumbled across many bits and pieces of information regarding how to deploy SharePoint farm solutions, but alas, I could not find a single article which contained all of the necessary steps to get a web part to appear in SharePoint. After several frustrating hours I was able to discover the procedure, and now, I am here to pass it along to you. So without further ado…
1. Copy the WSP file to your SharePoint server
2. Open the SharePoint 2010 Management Shell
3. stsadm –o addsolution -filename {WSP file name}
4. stsadm –o deploysolution –name {WSP file name} –url http://{the name of your SharePoint server} –immediate –allowGacDeployment -allowCasPolicies
5. stsadm –o activatefeature – name {name of feature} –url http://{the name of your SharePoint server}
6. Go in to SharePoint and your web parts should appear
One thing which was poorly documented and tricky to figure out was the activation of the feature. Please notice the name parameter of step 5 says name of feature, not name of solution. This is important as if you do not enter the correct name, the web part will not be activated and will be unavailable. The feature name (if unchanged in Visual Studio) usually follows the naming convention of:
{solution name}_Feature1
I hope this helps you on your way to developing compelling web parts for SharePoint 2010. We here at DMC are experts with SharePoint and Microsoft technologies, and would love to help you implement whatever solution your business needs.
Until next time, you stay classy Chicago.