1

I have created a SP 2013 solution, and I want to deploy this in my farm. But the requirement is that I don't want this wsp to be available in all the web applications. It should target only to my web application - say http://server1:123/.

By default when I deploy the solution using VS 2012 it will be globally deployed. May I know, how to restrict the wsp to be deployed globally such that it is targeted only to a particular web application. Any extra settings or any xml elements in VS 2012 or using PowerShell, for achieving this?

3 Answers 3

2

Here is the powershell command to deploy WSP to particular web application only :

Install-SPSolution your_solution_name.wsp –webapplication http://server1:123 –GACDeployment

3
  • have you already tried with this approach.i am getting web application resources etc etc error while i run this command.
    – samolpp2
    Apr 17, 2015 at 5:52
  • 1
    A WSP is not deployed globally or per Web app as per the admin will: it's an intrinsic property of the package.
    – Evariste
    Apr 17, 2015 at 5:53
  • @SaMolPP -- I have already tried the same powershell command and it is working fine for me. May be You should read this article from technet, this could help you out -- "technet.microsoft.com/en-us/library/ff607534.aspx". Apr 17, 2015 at 7:20
2

SharePoint solutions (non-sandboxed) can be deployed at both two scopes "Globally" and "Web Application".

As stated by bloger Jan Steenbeek at Deploying solutions to a specific Web Application:

"SharePoint has the annoying" (Debatably) "habit of forcing you to deploy globally whenever possible. When you try to deploy a global solution to a specific url you get the following message: - This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application."

So Sharepoint detects by the own definition of the solution package that must be deployed at Web Application scope or not. However depending on the customizations you are deploying you cannot avoid use of this resources from another webapp on the same farm (_layouts files for example). As stated briefly but precise by Evariste on a previous comment of another answer: "A WSP is not deployed globally or per Web app as per the admin will: it's an intrinsic property of the package".

Although you can work with Steenbeek's trick but keeping all this in mind.

1

Short answer: a WSP cannot be deployed on a given Web app.

First of all, a WSP can contain different artefacts:

  • _layousts files (application pages, JavaScript, CSS, images...): those "resources" are by definition available to all the SharePoint farm.
  • Features
  • Features that embed a Web part or anything else that requires a web.config modification.

In the latter case, the WSP is not deployed "globally" but on a target Web application basis. It means you have to choose what Web apps you target so their web.config file is modified to support the Web part. The "weird" behavior here is thar, in all cases, features will still appear in all site collections of all Web application (meaning you may activate the feature and use the Web part on a Web app where the web.config has not been edited, resulting in an error).

A mitigation is to hide the features from the UI so only an admin can activate them where relevant, from PowerShell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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