Just For Reference – Deploying SharePoint Solution Packages


Inevitably, right-click-deploy will fail you.  It’s not if, it’s when.  And if you’re as lucky as I am, SharePoint is not your primary technology; you don’t bath in it daily.  You visit it like the angry aunt who pinches your cheeks too hard and gives you wormy apples as a gift.  It means well, it just don’t know any better because it’s had a rough life.  This blog has served as my “reference” point for annoying things I have to remember.  Here’s another one:  Deploying Packages.  If you right click deploy and Visual Studio gives various errors (timeouts, locked files, etc), it might be time to nuke the package from your farm and do it the right way.  So lets crack open that SharePoint Administration PowerShell and navigate to a directory containing your wsp.

Step 1: Out with the old…

If your package contains web application resources, perform the following:

Uninstall-SPSolution -Identity [FileName] -Local -Confirm:$false -AllWebApplications

Otherwise:

Uninstall-SPSolution -Identity [FileName] -Local -Confirm:$false

Once you’ve uninstalled the package, you need to remove it:

Remove-SPSolution -Identity [FileName] -Confirm:$false -Force

Step 2: In with the new…

Now that we should have irradiate the old solution, we need to push it up the farm and install it:

Add-SPSolution -LiteralPath [Fully Qualified Path to WSP] -Confirm:$false

If your package contains web application resources, perform the following:

Install-SPSolution -Identity $file.Name -GACDeployment -Confirm:$false -Force -WebApplication $webApp

Otherwise:

Install-SPSolution -Identity $file.Name -GACDeployment -Confirm:$false -Force

Web Application Resources?  What’s that?!

Different packages contain different kinds of content.  If you’re dealing with lists, configuration, etc, you probably don’t have a package that contains web application resources.  If you’re installing web parts, you probably do.  An easy way to find out is to run this command:

$solution = Get-SPSolution [FileName]
$solution.ContainsWebApplicationResource

Enjoy, and may the right-click-deploy be with you!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s