I’ve ran across a problem with multiple deployment packages that don’t want to deploy to the specified Web Application that has been identified. I get the “This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application” error message and myself banging my head against the wall. This is what worked for me.
Even if everything about your solution package and your PowerShell script is catered to a specific Web Application, SharePoint can deny your deployment plans.
Another way to trick SharePoint to deploy a Web Application scoped solution is to add an empty/dummy safe control assembly to your deployment package.
In Visual Studio (im using VS13)
- Open up your “Package.package” file
- Switch the tab to the “Advanced” tab
- Click the “Add” then “Add Assembly from Project Output“
- Select your existing project name for the source
- Click the button to add a new item in the “Safe Controls” area.
- The Namespace and Assembly name can be the same as your project
- Click Ok
- Your new dummy Assembly item should look similar to the following:
The trick is fooling SharePoint into registering your solution as a web application scoped solution. SharePoint checks whether there are items which have to be deployed to a specific web application when your solution is added to the solution gallery. One of the elements that SharePoint checks for are safe control entries. These have to be merged into a web.config for a specific web application. The easiest way to force deployment to a specific web application is adding a dummy safe control entry to your package.
Now go ahead and re-create your deployment package and add it to your specific Web Application. This solution specifically worked for me and I have not had any problems on my Farm. There are other solutions out there that resolve problems SIMILAR to this, so I’m going to list them below as well.
References
- http://blogs.msdn.com/b/jjameson/archive/2007/06/17/issues-deploying-sharepoint-solution-packages.aspx
- https://ybbest.wordpress.com/2012/11/17/how-to-fix-error-this-solution-contains-no-resources-scoped-for-a-web-application-and-cannot-be-deployed-to-a-particular-web-application/
- http://sharedpointers.blogspot.com/2011/03/deploying-solutions-to-specific-web.html