If you’ve done any custom .NET development against Dynamics CRM you’ve undoubtedly downloaded the Dynamics CRM SDK and run a few of the samples to get a feel for how things work. You’ve probably also noticed that all the .NET samples use one or more assemblies that ship with the SDK to make things work. If you’re developing against CRM 2011 or 2013 and haven’t moved things around, all the samples should just work as all the project references are already set to point to the assemblies in the SDK’s bin folder. In CRM 2015 this has changed, instead of using that fixed path the samples are now configured to use NuGet as the source of the required assemblies.
Question: So what is NuGet?
Answer: Basically it’s a central, web based repository that provides a quick and easy way to share packages of files that can be included in development projects. Now with this change when you build one of the SDK sample projects if the assemblies aren’t present in the project they will be downloaded automatically.
Question: What is the benefit?
Answer: One major benefit is that you no longer need to rely on a specific path to a file being present. A common problem that surfaces in multi-developer environments is that each developer has their SDK assemblies downloaded to a different location. When the first developer creates a project and adds an assembly reference it uses the path to the file on their local machine. When another developer checks the project out of source control, the project is still looking for that same path when it starts to look for all the referenced files. Inevitably this will fail and the references will need to be fixed, which then presents the same problem back to the original developer when they get the latest version. With NuGet files are downloaded directly to each user’s project folder.
Question: What is required to use NuGet?
Answer: Support for NuGet comes in the form of a Visual Studio extension and is available for Visual Studio 2010 and later.
Question: What versions of CRM assemblies are stored on NuGet and how do I get them?
Answer: Starting with the last 2 releases of the CRM 2011 assemblies all subsequent releases of CRM 2013/SP1 and 2015 are present. The assemblies are broken into 3 separate packages depending on your needs:
Core Assemblies – Microsoft.Xrm.Sdk & Microsoft.Crm.Sdk.Proxy
Workflow Assembly – Microsoft.Xrm.Sdk.Workflow
Client and Portal Assemblies – Microsoft.Xrm.Client & Microsoft.Xrm.Portal
You can use the Package Manager Dialog in Visual Studio to browse for a particular package or you can quickly use the Package Manager Console to target a specific version. If you use the Package Manager Dialog approach you’ll need to do a little searching to find what you need but as a reward you’ll have the benefit of being able to select which project(s) the package should be applied to.
If you go the Package Manager Console route you can look up the specific version you want to install from the NuGet site and then target a specific project with a single command. If you don’t specify a version you’ll end up with the latest version available which is currently CRM 2015 and if you don’t specify a project it will be applied to all of them in your solution.
Not into coding? Check out these tips to use some of Dynamics CRM’s built in functionality to achieve amazing things!