We use SP2013 and PowerShell to deploy wsps.

When installing the wsp via PowerShell:


Add-SPSolution -LiteralPath $path
install-spsolution -Identity $solution  -GACDeployment

Above PowerShell will deploy the wsp to the GAC on server and deploy to all URLS.


Add-SPSolution -LiteralPath $path
install-spsolution -Identity $solution -WebApplication $oURL  -GACDeployment

Above powershell deploys the WSP to the GAC on server and deploy only to 1 specific web application (not in bin folder).


How to deploy to the URL at bin folder on server?

My questions here are:-

  1. Case 1 makes the wsp (say webpart) available for each webapplication on server, what about Case 2? Since it is deployed at 1 particular webURL, wont it be usable from the other web apps? What is this concept?

  2. For CASE 3, please provide me powershell code.

  3. I have read that:-

SharePoint solutions are either deployed globally or targeted to a particular web application. The decision of which is made automatically by the SharePoint Solution framework depending on the contents of the solution manifest.

But, this can be also controlled by PowerShell, no matter what is the setting in the solution manifest, am I right?


No, the solution dictates if it's global or per web application.

WebApp Scope
If the solution contains resources that's web application specific like:
- Dll deployed to bin
- Dll with SafeControls
- files to the other hostdir folders
then the solution must be installed to specific web application(s) by either specifying web applications like:

Install-SPSolution -Identity $solution -WebApplication $webApp

or by specifying that you want to deploy to all:

Install-SPSolution -Identity $solution -AllWebApplications

Global Scope
If there is no web application specific resources then it's installed globally using

Install-SPSolution -Identity $solution

How do I control if my dll goes to GAC or bin?
The placement of your dll(s) is controlled by the manifest.xml in the solution and is con trolled by the DeploymentTarget attribute of the <Assembly> element(s).

Here I deploy to GAC:

<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="3086e4c4-aa41-45a4-b2f2-6c0d3fddc99f" SharePointProductVersion="15.0">
    <Assembly Location="Test.dll" DeploymentTarget="GlobalAssemblyCache">
    <FeatureManifest Location="Test_Feature1\Feature.xml" />

And here to bin folder:

<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="3086e4c4-aa41-45a4-b2f2-6c0d3fddc99f" SharePointProductVersion="15.0">
    <Assembly Location="Test.dll" DeploymentTarget="WebApplication">
    <FeatureManifest Location="Test_Feature1\Feature.xml" />

As a developer you specify that in VS by selection your SharePoint Project in Solution Explorer and then in properties change Assembly Deployment Target:

enter image description here

  • Does Install-SPSolution -Identity $solution -AllWebApplications put the dll into bin fodler of every web app? – variable Apr 25 '14 at 7:37
  • Also can you be more clear on my CASE 1, say we have webpart which has been deployed to bin of webapp1, then on webapp2 can we safely use the webpart? Are there any implications to be considered? – variable Apr 25 '14 at 7:39
  • I've added a section to my answer which describe how you specify whether your dll goes to GAC or Bin. If your Dll goes to bin, then Install-SPSolution with -AllWebApplications will add it to bin folder of every web app. If webpart is deployed to bin folder of webapp1, but not webapp2, then there is no way to load it on webapp2. – Per Jakobsen Apr 25 '14 at 9:12
  • In your last comment you have confused me. In the answer you say that the manifest contents (DeploymentTarget=GlobalAssemblyCache/Webapp) control where the dll goes to. But in the last comment you say that "If your Dll goes to bin, then Install-SPSolution with -AllWebApplications will add it to bin folder of every web app." Thats confusing. My question now is:- If manifest specifies DeploymentTarget=webapp and you use powershell as:install-spsolution -Identity $solution -GACDeployment, then, where will DLL get deployed? – variable Apr 25 '14 at 10:05
  • 2
    If your solution specifies DeploymentTarget=webapp and you try to install it using install-spsolution -Identity $solution -GACDeployment it'll complain saying that you need to specify which web applications to deploy to. -GACDeployment does not mean 'Deploy dlls to GAC' it means 'I as a SharePoint admin allows this SPSolution to install something to the GAC IF that's specified in it'. The corresponding option in the old STSADM tool was -AllowGACDeployment – Per Jakobsen Apr 25 '14 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.