Hey everyone – we have a great article today provided by a guest blogger Kenichiro Nakamura from our Japan office – he’s also a Microsoft Dynamics CRM PFE who recently joined PFE from the CRM support team. Recently, he’s been a blogging maniac on the Dynamics Japan blog, posting dozens of articles and even translating our CRM in the field blog articles for their dedicated readers – as such all his articles are in Japanese. In an effort to keep his English translation skills sharp and help keep our blog content fresh he’s going to work with our writers to post English versions of his blog articles!
Today’s post highlights a nice feature that many of you may not have realized is out there. Our CRM SDK dev team is now hosting the Microsoft Dynamics CRM SDK assemblies on NuGet.
What/Why is NuGet?
When you develop CRM SDK program like console application or plug-ins, one of the first things you is download the SDK package and pull out the SDK assemblies for references. Then whenever a new SDK version is available, you have to re-download full SDK packages and update references manually – something that can be painful.
NuGet is a package manager for the Microsoft development platform, it also has a Visual Studio add-in which helps developers manage updates and retrieving older versions. By using NuGet, you can download necessary assemblies from within your project and it automatically adds additional references, too! When newer version of assemblies are available, Visual Studio will alert you and you can easily update assemblies by single click!
Currently we have 5 NuGet packages and today, we will show you how to use them in your Visual Studio projects.
Step by Step
1. Open Visual Studio and create new project. In this demo, I created .NET Framework 4.0 C# console application (make sure you don’t accidentally target the Client Profile as CRM Projects will only compile under the .NET 4.0 profile).
2. Right click project and select “Manage NuGet Packages…”.
3. Select Online on the left pane, and search “crmsdk”. At this moment, it will find 5 NuGet packages then select “Microsoft Dynamics CRM 2013 SDK core assemblies”, and click “Install”.
4. It will install the package.
5. Some packages ask you license acceptance, if prompted, accept license agreement (after you read it, of course)
6. Close NuGet Package Manager after completing installation.
7. Expand “References” to confirm you have CRM SDK assemblies, as well as additional references.
Now, what happens when the next UR of CRM 2013 ships or an updated version of the SDK binaries are released – or what if your project needs to target an older version? Here we’ll install older version of the CRM NuGet package to test the update experience. To do so, you need to use Package Manager Console to install older version by using command.
1. In your project
2. Click TOOLS | Library Package Manager | Package Manager Console.
3. Type following command in the Package Manager Console.
>Install-Package Microsoft.CrmSdk.CoreAssemblies -Version 6.0.0
4. After it completes package installation, expand Reference to confirm it downloaded all the assemblies as expected. Now your project has older version of assemblies.
5. You will eventually be notified when there is newer version, but to save time here, let’s check for the updated assemblies manually.
6. Right click your project and click “Manage NuGet Packages….”
7. Click Updates on the left pane. It automatically finds update. You just need to click Update button to update them.
Microsoft Dynamics CRM 2011 SDKs
You can also use NuGet to obtain Microsoft Dynamics CRM 2011 SDK binaries, but in this case if you will have to specify your version because the latest assembly versions published are for Microsoft Dynamics CRM 2013.
For example, use following command to obtain 5.0.18.
>Install-Package Microsoft.CrmSdk.CoreAssemblies -Version 5.0.18
NOTE: If you are prompted to update your 2011 assemblies you should ignore the updates, if you accept the updates they will bring down the latest version 6.0 DLL’s replacing the 2011 V5 DLL’s.
Have questions about this? Looking for guidance or workshops on CRM Developer topics? Please reach out and let us know – use the contact links on our site. Also, don’t forget about Dynamics Convergence 2014 March 4th – 7th – if you haven’t registered yet head on over and get registered. We’ll be speaking in no fewer than seven Dynamics CRM sessions this year and we absolutely want readers of our blog to be there to ask questions and say hello! For a list of our sessions – head over to the Schedule Builder and search for speakers: Shawn Dieken, Sean McNellis, Jeff Thompson, Brandon Kelly, and Daren Turner for a list of our sessions.
Thanks for reading!
Ken & Sean