2010年3月28日 星期日

How to add solution file (.wsp) to SharePoint 2010

In SharePoint 2007, we use stsadm to config SharePoint. Now we need to use powershell to set configuration in 2010.

If we need to add a solution file to SharePoint 2007, we use stsadm command as following:
stsadm –o addsolution –name SharePointProject.wsp

In SharePoint 2010, the powershell command is as following:

Add-SPSolution c:\SharePointProject.wsp

In this case you don’t actually have to type –literalpath before the parameter. This is what it looks like when executed. You can see that it displays the id of the solution along with its deployment status.

PowerShellAddSolution


After you add solution package to server farm, you can deploy in central administartion->System setting->farm solution management.

If you retract your solution fail by central administration page, you can use power shell tool to retract your solution. However, powershell doesn't have retract command anymore. Please use uninstall.

Uninstall-SPSolution –Identity SharePointProject.wsp –WebApplication http://sp2010

If you just need to update your solution file, you can use this code as following:

Update-SPSolution –Identity SharePointProject.wsp –LiteralPath c:\SharePointProject.wspGACDeployment

沒有留言: