Last modified at 3/16/2014 12:12 PM by Koen Zomers

By default, most SharePoint 2010 solutions created in Visual Studio 2010 will be globally deployed to SharePoint farms. It doesn't matter if you deploy directly from Visual Studio or use any of the other methods like deploying using PowerShell. In SharePoint 2010 Central Administration under System Settings -> Farm Management -> Manage farm solutions you will find your solution to carry the Deployed To Globally deployed status:


This has several disadvantages:

First, deploying solutions globally will cause all webapplications on the farm (including central administration) to be targeted and thus receive an IIS Pool recycle. Even though your solution was specifically for one webapplication, all others will also be braught down for a minute.

Second, Visual Studio 2010 by default enabled all features in solutions after deploying them. This will enable the features in the solution to be enabled on all webapplications on the farm including central administration. Imagine having a solution which modifies the web.config, this will therefore happen to all webapps which is not a good thing.

Third, it doesn't allow you to easily identify what solutions belong to what webapplications.

To avoid this from happening, there is an easy workaround:

  1. Open up your SharePoint 2010 solution in Visual Studio 2010
  2. In the Solution Explorer (use View -> Solution Explorer if you don't see it) expand your solution and browse to the Package within your project

  3. Double click on the Package.package entry to open up the package editor
  4. All the way at the bottom you will find three buttons of which the middle one being Advanced. Click on it.

  5. The Additional Assemblies screen will show with at the right a button Add. Click on it and in the menu that appears, click on Add Assembly from Project Output.
  6. At Source Project select the project in your current solution which you want to change to being deployed to a specific webapplication.
  7. You'll notice that the Location field will be automatically filled in. Leave the Deployment Target at GlobalAssemblyCache.
  8. From the Location field, select the whole entry without the .dll at the end and copy it to your Windows clipboard using ctrl+c.
  9. Under Safe Controls click on the Click here to add a new item button.
  10. Double click on the white field in the Namespace column to edit it and paste the contents of your clipboard using ctrl+v
  11. Do the same in the Assembly Name column. Your screen should now look comparable to the following screenshot:
  12. Click OK to close the Window
  13. You should notice the entry being added:

  14. In the solution explorer, click once on your project and press F4 to open its properties.
  15. You will see a property called Include Assembly In Package. Switch this to False.

  16. You're all set now. Redeploy your solution from Visual Studio 2010 and check out the installed solutions in Central Administration. Your solution should now show as being deployed to only its own WebApplication.