Friday, October 20, 2017

SharePoint 2013: Updating a Custom Solution

Introduction

This posting consolidates notes and references associated with updating a custom solution in a customer environment.  In this instance, the updated solution involved a farm solution having web scope and deployed to a specific web application.  Not all possible steps are included here, but only those engaged in the particular instance. 
The general procedure involved the following key steps:
  1. De-activate solution features
  2. Retract the solution
  3. Remove the solution
  4. Install the new solution
  5. Deploy the new solution
Each of the steps that were performed will be discussed here. 

Procedure

Deactivate Solution Features

  1. Engaged the developer to identify the solution package that needs to be updated.  This will end in ".WSP". Let's call it MySolution.wsp.  Also engaged the developer to identify the scope of the features introduced by the solution and what web application, site collection and/or web that solution features are activated in.  In this case, the solution introduced a single feature, call it MySolutionFeature.
  2. Navigated to C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\, and verified that only one feature is listed that is associated with the solution.
  3. Opened the feature folder, MySolutionFeature.
  4. Opened Features.xml and verified the feature scope.
  5. On a farm SharePoint server, opened an elevated SharePoint Management Shell (SMS), and then executed the following:
    $packageName = "MySolution.wsp"
    $solId = (Get-SPSolution $packageName).Id
    Get-SPFeature | where {$_.solutionId -eq $solId}|select DisplayName, Scope
    
    This returned a listing of features associated with the solution. You need to know what the solution features are so that you can ensure you have deactivated all of them.  In this particular instance, the solution features are known to be activated in a single web within a single site collection of the target web application so they are easy to identify.  Thus, this listing served as a useful guide, but wasn't necessary.
  6. Navigated to the web's Manage Features page and deactivate the feature.  This task was performed by the developer who new the web where the feature had been activated.  This could also have been automated via PowerShell.  See Disable-SPFeature for details.
  7. Verified with the developer that the solution did not add any artifacts to the content database (e.g., .WebPart files in the Web Part Gallery) when it was installed.

Retract the Solution

  1. Launched Central Administration and navigated to: System Settings > Manage farm solutions.  This displayed the Solution Management page.
  2. Clicked on MySolution.wsp.  This displayed the Solution Properties page.  Noted and verified all data displayed.
  3. Clicked on Retract Solution.
  4. Selected the web application to retract the solution from, leaving the other fields default, and clicked OK.
  5. Refreshed the Solution Management page until the status of the solution indicated Not Deployed.
  6. On the Solution Management page, clicked MySolution.wsp.  This showed the Solution Properties page.
  7. Verified the last operation completed successfully and that the solution was removed from each farm server hosting the web application to which the solution was deployed.  This includes removal of associated feature folders.
  8. Navigated to C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\, and verified that the feature folder, MySolutionFeature, was removed.

Remove the Solution

  1. On the Solution Management page, clicked MySolution.wsp.  This showed the Solution Properties page, this time showing the Remove Solution function for MySolution.wsp.
  2. Clicked Remove Solution.
  3. Clicked OK at the prompt.
  4. On the Solution Management page, verified that the solution no longer appears listed.
  5. In an elevated SMS, executed Get-SPSolution and verified that the solution no longer appears listed.

Install the New Solution

  1. Identified a folder in which to place MySolution.wsp.
  2. On a farm SharePoint server, opened an elevated SharePoint Management Shell (SMS), and then executed the following:
    Add-SPSolution -LiteralPath "[PathToFolder]\MySolution.wsp"
    
  3. Navigated to the Solution Management page, and then verified that the solution, MySolution.wsp, was listed there with status Not Deployed and deployed to None.
  4. Clicked on MySolution.wsp and verified that the Deployment Status was Not Deployed.

Deploy the New Solution

  1. On the Solution Management page, clicked on MySolution.wsp and viewed the Deploy Solution page.
  2. On the Deploy Solution page, clicked Deploy Solution.
  3. On the Deploy Solution page, selected the target web application, and then clicked OK.
  4. On the Solution Management page, refreshed the page occasionally, until the status of the solution becomes Deployed.
  5. Clicked on the solution to the view the Solution Properties page.
  6. Verified that the last operation result states The solution was successfully deployed.

References

No comments: