Quickly adding assemblies references using the Object Browser

I create very often little projects to try things out: either based on the Console Application or the Class Library template. As it's SharePoint development we're speaking of the first thing you need to do is to add references to the Microsoft.SharePoint assembly. Depending on what you're doing you might need to add the references to System.Web and Microsoft.SharePoint.Publishing as well or maybe even more. You can do it just the regular way by clicking with right button on the project References and adding new reference but there is a faster way.

I've been brought to this idea while reading one of the Visual Studio tips by Sara Ford: Did you know… You can add references to your solution directly from the Object Browser - #210. What Sara didn't mention is that you can create your Custom Component Set. Think of it as of a set of bookmarks or favorites.

So what you do first is to open the Object Browser (View > Object Browser or Ctrl+Alt+J). From the Browse list select Edit Custom Component Set...

Edit Custom Component Set

In the Edit Custom Component Set dialog you can manage the list of your assemblies:

Edit Custom Component Set dialog

The assemblies you've just added will appear in the Custom Component Set list

Custom Component Set overview

After adding a few assemblies to the list you can test how it all works. Create new Project and add one of the assemblies using the Object Browser:

Add Reference using the Object Browser Custom Component Set

And that's all. Keeping the frequently used assemblies in the Custom Component Set list enables you to add the required references very quickly. The above approach is in my opinion, slightly slower than creating a custom Project Template with the required references in the right place, but definitely much more flexible and manageable.

Comments

comments powered by Disqus