Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
2.1k views
in SharePoint Server by 37 41 48

I got this error Install-SPSolution : This solution contains resources scoped for a Web application and must be deployed to one or more Web applications. when installing a new SharePoint solution using PowerShell, How to fix this error in SharePoint Server 2019?

Install-SPSolution 6ca32b40-73f1-4b39-8ed3-121ff6d46de5 -GACDeployment
Install-SPSolution : This solution contains resources scoped for a
Web application and must be deployed to one or more Web
applications.
At line:1 char:1
+ Install-SPSolution 6ca32b40-73f1-4b39-8ed3-121ff6d46de5
-GACDeploymen ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...Inst
   allSolution:SPCmdletInstallSolution) [Install-SPSolution], SPE
  xception
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCm
   dletInstallSolution

1 Answer

1 like 0 dislike
by 158 184 366
selected by
 
Best answer

Solving: This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.

Getting this error "Install-SPSolution : This solution contains resources scoped for a Web application and must be deployed to one or more Web applications." means the WSP solution that you are trying to deploy has some resources like resources files or a feature that scoped for a web application and in this case, you must add the -WebApplication parameter to specify which web application you need to deploy your SharePoint WSP solution or use -AllWebApplications to deploy your solution globally for all web application within the farm.

Ex: Install SharePoint WSP solution using PowerShell for specific Web Application

To deploy your WSP SharePoint solution to a particular web application, you have to use the below PowerShell cmdlet:

Add-SPSolution -LiteralPath "C:\Solution\Qassas.wsp"
Install-SPSolution –Identity Qassas.wsp –WebApplication http://webAppURL/ -GACDeployment

Ex: Install SharePoint WSP solution using PowerShell for all Web Applications

To deploy your WSP SharePoint solution to all web applications across the farm, you have to use the below PowerShell cmdlet:

Add-SPSolution -LiteralPath "C:\Solution\Qassas.wsp"
Install-SPSolution –Identity Qassas.wsp -AllWebApplications -GACDeployment

For more details, Please check How to Install and deploy WSP SharePoint Solution Using PowerShell


See Also

If you don’t ask, the answer is always NO!
...