Tip #230: Ban the browse button

Corporal punishment by bayonetsI like German words. Take, for example, Spießrutenlaufen. If you like me, and don’t speak a word of German, you know, just by looking, that the word means business, the word means corporal punishment.

I often wonder if ignorance of the developers can be cured by introduction of Spießrutenlaufen for coders. Function is longer than the screen – slap on a wrist! Still using Polish notation – 3 cuffs! Broke the build – 7 kicks! Adding assembly references by hand – go stand in the corner for 10 minutes! On one hand!

What do you do if your project requires either 2011 or 2013 SDK assembly? Do you click Add > Reference for the project and then click Browse button to get to this?
Adding assembly references

If yes, then look at this word again: Spießrutenlaufen. Why is adding assemblies bad? Where do I begin? Versions, for one. Broken path to assembly, another reason. My SDK assemblies are in q:\__(@#$%^&)__\randomstringtomakeaverylongfoldername\schadenfreude folder, that’s why you’ll be seeing yellow exclamation marks when loading one of my projects.

Since all 2011 and 2013 SDK assemblies have been published on NuGet, there is absolutely no reason to use evil Browse button. Need to work with 2013? Simple steps:

  1. Click Tools > NuGet Package Manager > Manage NuGet Packages for Solution
  2. Click Online > nuget.org
  3. Search for CRM 2013
  4. Depending on your project needs select one of the packages (hint: when selecting a package, read the description on the right hand side to see what assemblies are on offer), click Install

That’s it in the nutshell. Use your search-fu to find more information about precise version management, how to make nuget and source repository play well together, etc.

And, yes, NuGet packages already contain 6.1.1 assemblies and references in your project will be automatically refreshed, no need to do anything.

Leave a Reply

Your email address will not be published. Required fields are marked *