Thursday, March 14, 2013

Deploy SharePoint solutions at web application level

SharePoint solution packages by default get installed to "Globally" scope when you don't have any resources which are web application scoped. It is not a logical decision to deploy in web application scope when I have Assemblies to GAC, Application pages to Layouts folder etc. If there are any resources which are targeted at web application scope like deploying assemblies at Application bin directory, safe control entry etc then the solution deployment will force us to deploy at web application level.

Some times you will have assemblies to GAC, not a web part project and don't have any resources which are scoped against web application. At this juncture, you may need to deploy the solution at web application scope for various reasons like

  • Security  - To hide features part of the solution from showing off in other web applications.
  • Shared Environment - Other applications running in the Farm and they don't to get impacted of your WSP
  • Isolation - Having a global scoped WSP will recycle all app pools during deployment
This can be achieved by adding a safe control entry to the solution package and solution deployment script will be satisfied by this. If it is MOSS 2007 then its matter of Manifest.xml modification. But SharePoint 2010 is powered with Visual Studio 2010 tools for SharePoint, if we make any modification to Manifest.xml then the Package designer will ignore its support to the developer.

The solution would be, open your package designer, scroll down and find the Advanced Tab, click on "Add" button to add additional assemblies.



Select "Add assembly from project output", input the namespace and full assembly name for the safe controls.

Save these settings and hit on Ok button,one more setting to update. Click on the project in solution explorer and press F4 to open the properties window, exclude the assembly from being copied to solution package.Because we already added the assembly in "Additional Assembly" section.


Package and deploy the solution at web application level scope.

No comments: