Deploying solutions to a specific Web Application Issues Resolved

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.

Deploying a solution to a specific Web App cannot be deployed.
Deploying a solution to a specific Web App cannot be deployed error message

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)

  1. Open up your “Package.package” file
  2. Switch the tab to the “Advanced” tab
  3. Click the “Add” then “Add Assembly from Project Output
  4. Select your existing project name for the source
  5. Click the button to add a new item in the “Safe Controls” area.
  6. The Namespace and Assembly name can be the same as your project
  7. Click Ok
  8. Your new dummy Assembly item should look similar to the following:
Add a dummy Safe Control to your Package Manifest in Visual Studio.
Add a dummy Safe Control to your Package Manifest in Visual Studio.

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.