Commands For "Add", "Install", "Update" The Solutions For SharePoint Site

In my last article, we saw how to create a SharePoint farm solutions project. After we have completed the project development, we can deploy the WSP to the SharePoint Server. WSP will be available after we publish the project in Visual Studio.

Steps to Add, Install and Update the WSP

Follow the below listed steps to deploy the WSP in SP Server.

Step 1

Open the SharePoint Management Shell with administrator rights in Server.

SharePoint

ADD Solution

Now, add the WSP solution first using the below command,

Add-SPSolution “Documents\Your WSP Name.wsp”

E.g

Add-SPSolution “C:\Workings\AE_WSP\SampleSPProject.wsp”

SharePoint

Open the Central Admin and go to System Settings from the left navigation. Now, select "Manage Farm Solutions" to check the status of your solution.


SharePoint

INSTALL SP solution

Then, install the WSP to the WebApplication by running following command in Management Shell,

Install-SPSolution –Identity "WSP Name".wsp –WebApplication "Site Url" –GACDeployment -fulltrustbindeployment -force

E.g

Install-SPSolution –Identity "SampleSPProject.wsp” –WebApplication "http://test:8888/" –GACDeployment -fulltrustbindeployment -force

SharePoint

Finally, your solution will be deployed successfully. We can check the status in Central Admin, as shown in below image.

SharePoint
UPDATE Solution

If we want to update the solution, we can use the below command in PowerShell to update the previous solution,

Update-SPSolution -Identity "WSPNAME.wsp" -LiteralPath "PATHFORWSP\SampleSPProject.wsp" -GACDeployment -FullTrustBinDeployment -Force

E.g

Update-SPSolution -Identity "SampleSPProject.wsp" -LiteralPath "C:\Workings\AE_WSP\SampleSPProject.wsp" -GACDeployment -FullTrustBinDeployment –Force

SharePoint

In Central Admin's "Manage Farm Solutions, we can check the status, as shown below.

SharePoint

Finally, our solution will be updated successfully.

SharePoint

UNINSTALL solution

Run the below command to uninstall the WSP in Management Shell.

Uninstall-SPSolution -Identity "wspname.wsp"

E.g

Uninstall-SPSolution -Identity "SampleSPProject.wsp"

When you uninstall the WSP it ensure that to perform this operation as shown below, type “Y” to proceed,

SharePoint

REMOVE Solution

Use the below command to remove the WSP solution.

Remove-SPSolution –Identity “SampleSPProject.wsp” -force

SharePoint

Summary

In this article, we have explored how to add, install, update, remove and uninstall the WSP package in SharePoint 2016 server.