8

I have a powershell script that deploys about 12 web parts. They have all been created in the manner through visual studio 2010 and are being deployed to sharepoint 2010.

I am getting the following error when running Install-SPSolution for one of my web parts: Install-SPSolution : This solution contains no resources scoped for a Web appli cation and cannot be deployed to a particular Web application.

Can someone help me debug this? Every other Install-SPSolution command uses -AllWebApplications, and I do not want to specify the web application directly using -URL. Here is the command that is breaking (this is the same command used to successfully deploy all 11 other web parts):

Install-SPSolution –Identity PortalSelector.wsp -AllWebApplications -GACDeployment

Thanks.

1
  • Interesting that a web part solution contains no web application-scoped resources... normally I would expect at least a SafeControls entry. Does the web part that is breaking have its own code class?
    – Paul Lucas
    Commented Aug 11, 2010 at 20:40

3 Answers 3

11

If the solution has no web application resources it is considered a global solution and does not actually need to target an web applications. Remove the -AllWebApplicaitons and this global solution will be deployed globally to the farm and will be available to all web applicaitons.

1
  • Agreed. -AllWebApplications is (I believe) the analogue to -allcontenturls back in the days of stsadm, which would produce the exact same behaviour and error message.
    – James Love
    Commented Aug 11, 2010 at 20:57
9

Or try checking the ContainsWebApplicationResource property on the solution object itself

$solutions = Get-SPSolution
foreach ($solution in $solutions)
{    
    if ($solution.ContainsWebApplicationResource)
    {
        $solution | Install-SPSolution -AllWebApplications -Confirm:$false
    }
    else
    {
        $solution | Install-SPSolution -Confirm:$false
    }
}
1
  • Only get solutions that haven't been deployed: $solutions = Get-SPSolution | Where { $_.Deployed -eq $false} Commented Sep 17, 2018 at 17:56
1

I think question was how to deploy to a particular webapplication which is best practice also..

answer is

Install-SPSolution -Identity "MySPSolution.wsp" –WebApplication "http://localhost" –GACDeployment

Your Answer

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