Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We use SP2013 and PowerShell to deploy wsps.

When installing the wsp via PowerShell:

CASE 1:

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.

CASE 2:

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).

CASE 3:

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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">
  <Assemblies>
    <Assembly Location="Test.dll" DeploymentTarget="GlobalAssemblyCache">
    </Assembly>
  </Assemblies>
  <FeatureManifests>
    <FeatureManifest Location="Test_Feature1\Feature.xml" />
  </FeatureManifests>
</Solution>

And here to bin folder:

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

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

share|improve this answer
    
Does Install-SPSolution -Identity $solution -AllWebApplications put the dll into bin fodler of every web app? –  variable Apr 25 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 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 at 9:12
    
thanks man, thats fantastic –  variable Apr 25 at 10:00
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 at 10:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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