Solutions: Developing, Installation, and Retraction SharePoint 2007 & 2010

SharePoint 2007 Developing Solutions

Developing SharePoint Solutions 2010

Uninstallation and Retraction of a Farm Solution

I read this on a blog, I did not know this.

When the features are deployed as Solution, the features seem to get installed in all web app. This is the default OOB behavior. We can install feature only at farm level. Can’t be done at web app / Site collection level. – The only option is to set the feature’s hidden field to true. Hide the feature and install the feature. – Then only to the web app required we can activate it by specifying -url in stsadm command.

Awesome article for creating new lists

The following is from Nick Patel Blog – great detail

Other Articles

This blog series will outline what are the major steps required for farm level custom solution deployment and retraction process for SharePoint 2010, how you can automate the process using PowerShell, and how you can

During SharePoint 2007, STSADM was available to script the custom solutions deployment/retraction process. In SharePoint 2010, Microsoft has introduced PowerShell as preferred technology to script custom solutions deployment/retraction process. This blog series will outline what are the major steps required for farm level custom solution deployment and retraction process for SharePoint 2010, how you can automate the process using PowerShell, and how you can automate the deployment execution using windows batch files.

Farm Level Solution deployment/retraction process.

Following two tables outlines what is supported and commands available at the browser, STSADM, and PowerShell.

Solutions Actions Central Admin PowerShell STSADM
View Solutions Yes Get-SPSolution -o enumsolutions
Add Solution – Add Solutions to Farm Solutions Gallery Not Supported Add-SPSolution -o addsolution
Deploy Solution – Deploys Solutions to the web applications Yes Install-SPSolution -o deploysolution
Update Solution – Update the deployed solution Not Supported Update-SPSolution -o upgradesolution
Retract Solution – retract solutions from the web applications Yes Uninstall-SPSolution -o retractsolution
Remove Solution – Remove the solution from the farm solutions gallery Yes Remove-SPSolution -o deletesolution
Feature Actions
Farm, App, Site, and Web 
PowerShell
STSADM
View Features – View features at the farm, web application, site collection, or site scope
Yes
Get-SPFeature
Not Supported
Install Feature – Install feature at the farm, web application, site collection, or site scope
No
Install-SPFeature
-o installfeature
Activate Feature – Activate feature at the farm, web application, site collection, or site scope
Yes
Enable-SPFeature
-o activatefeature
Deactivate Feature – Deactivate feature at the farm, web application, site collection, or site scope
Yes
Disable-SPFeature
-o deactivatefeature
Uninstall Feature – Uninstall feature at the farm, web application, site collection, or site scope
No
Uninstall-SPFeature
-o uninstallfeature
Typical Order of the Farm Solutions Deployment using the Power Shell Commands. upgrading solutions and features is not included.

Steps are: Add Solution -> Deploy Solution -> Install Feature -> Activate Feature -> Update Solution -> Upgrade Feature -> Deactivate Feature -> Uninstall Feature -> Retract Solution -> Delete Solution

image

We will use PowerShell from here on. Here is the high level overview of all the PowerShell commands to deploy/retract solutions, activate/deactivate features, and upgrading solutions and features.

  • Add Solution – Add-SPSolution
    • Adds a SharePoint solution package to the farm Solution gallery, It doesn’t deploy the uploaded solution yet.
    • Add-SPSolution -LiteralPath “c:\Project Initiation Web Parts.wsp”
  • Deploy Solution – Install-SPSolution
    • Deploys an installed SharePoint solution on all the WFE servers in the farm. This command also installs all the features on each server at the farm, web, site collection, and site level but It doesn’t activate them.
    • Since it provisions the file on each WFE, it is a timer job. It may take while to provision the files.
    • Install-SPSolution –Identity “Project Initiation Web Parts.wsp” –WebApplication http://sp2010vm -GACDeployment
    • Major Parameters
      • Identity – Name of the fully trusted solution
      • AllWebApplications or Web Application with URL – URL of the web application where solution will be deployed. For Global deployment for all web applications, specify AllWebApplications
      • Local – Solution will be deployed on only server where this command is being run
      • GACDeployment – To deploy artifacts into GAC
      • Time – Schedule the solution deployment at specified time. If this parameter is not specified, solution deployment process would run immediately during next timer job process
    • Major File System changes
      • Global Assembly Cache – C:\Windows\assembly (e.g. Deploys the DLL into GAC)
      • Web Application Directories – C:\inetpub\wwwroot\wss\VirtualDirectories (e.g. Updates the web.config and adds web part safe control entries – C:\inetpub\wwwroot\wss\VirtualDirectories\80)
      • SharePoint Root Folder – C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14
        • Adds new feature directory and provision the web part files – C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\
        • Adds new user controls – C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\
  • Install Feature – Install-SPFeature (Optional Step – included in Install-SPSolution)
    • Deploying solution in the farm installs the feature automatically. This is preferred method. No need to manually run this command.
    • Install-SPFeature <FeatureFolderName>
  • Activate Feature – Enable-SPFeature
    • Enables installed SharePoint Feature at the given scope. If the feature is a farm feature, no URL is needed. Otherwise, provide the URL where the feature is to be activated (explicit scope is not needed).
    • Enable-SPFeature –identity “MyCustomFeatureNameorGUID” -URL http://sp2010vm
    • Identity parameter is feature folder name or feature GUID
  • Update Solution – Update-SPSolution
    • Upgrades a deployed SharePoint solution in the farm. Use this cmdlet only if a new solution contains the same name, same set of files, and features as the deployed solution.
    • If files and features are different and feature version is not upgraded, the solution must be retracted and redeployed by using the Uninstall-SPSolution and Install-SPSolution cmdlets, respectively.
    • Update-SPSolution -Identity contoso_solution.wsp -LiteralPath c:\contoso_solution_v2.wsp -GACDeployment
  • Deactivate Feature – Disable-SPFeature
    • Disables installed SharePoint Feature at a given scope. If the scope of the Feature is the farm, the URL is not needed. Otherwise, provide the URL at which this Feature is to be deactivated (explicit scope is not needed).
    • Disable-SPFeature –identity “MyCustomFeatureNameorGUID” -URL http://sp2010vm
    • Identity parameter is feature folder name or feature GUID
  • Uninstall Feature – UnInstall-SPFeature (Optional Step – included in UnInstall-SPSolution)
    • Retracting solution in the farm uninstalls the feature automatically. This is preferred method. No need to manually run this command unless solution retraction process couldn’t uninstall features for some reasons.
    • UnInstall-SPFeature <FeatureFolderName>
  • Retract Solution – Uninstall-SPSolution
    • Retracts a deployed SharePoint solution from the farm entirely for all web application or given web application. If web application is not specified, this cmdlet removes files from all the front-end Web server.
    • Since it removes the file on each WFE, it is a timer job. It may take while to delete the files.
    • Uninstall-SPSolution –Identity “Project Initiation Web Parts.wsp” –WebApplication http://sp2010vm
    • Most items that go in the content database are not overwritten or deleted for you when the feature reinstalls or solutions are retracted. Most items that go on the file system are overwritten or deleted during the retraction process. There is exception to this rule – redeploying web parts deletes the web part from the web part gallery and imports the new updated version, if web part deployment conflict resolution property is set to the Automatic. Other options are None to ignore over write and prompt.
    • Removes deployed components from the file system
      • Deletes the DLL from the GAC – C:\Windows\assembly
      • Updates the web.config and removes web part safe control entries – C:\inetpub\wwwroot\wss\VirtualDirectories\80
      • Deletes the feature directory – C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\ProjectInitiationToolWebParts_ProjectInit
  • Delete Solution – Remove-SPSolution
    • Deletes a SharePoint solution from a farm solution gallery
    • Don’t deploy the solution when its being removed by this command. It may put the solution in the inconsistent state. Always verify that solution is removed from the farm solution gallery before kicking off the deploy process of same solution.
    • Remove-SPSolution -Identity “Project Initiation Web Parts.wsp”