In this post, we will learn how to fix “This solution contains no resources scoped for a Web application and cannot be deployed” error that you may face when deploying an Event Receiver in SharePoint Server.
- 1 SharePoint This solution contains no resources scoped for a Web application and cannot be deployed
You might also like to read Install and deploy SharePoint Solution Package (WSP) Using PowerShell
When I tried to deploy a SharePoint WSP solution that contains an Event Receiver to a specific SharePoint web application, I got the below error message:
This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application
To avoid this issue, you should be first aware of the Event Receiver should be deployed globally to all web application, you shouldn’t specify a specific web application scope when deploying the Event Receiver.
You should deploy the Event Reciever globally by removing “-WebApplication http://sitename” as the following:
Add-SPSolution "path of solution.wsp" Install-SPSolution -Identity "solution name".wsp -GacDeployment -force
Once the cmdlet is executed successfully, make sure that the SharePoint solution has been deployed properly by doing the following:
- Go to Central Administration > System Settings > Manage farm solutions.
In case you will deploy the Event Receiver directly from the Visual Studio, you should set the “Assembly Deployment Target” to “WebApplication” as the following:
- Open the Event Receiver SharePoint Solution.
- Go to the Solution “Properties“.
- Change the “Assembly Deployment Target” from “GlobalAssemblyCache“.
- To “WebApplication“.
- Build the solution.
- Deploy the generated WSP Solution that should now be deployed properly.
- SharePoint 2016.
- SharePoint 2013.
- SharePoint 2010.