Tip #1135: For plugins, use SDK with the same or below the server version

Problem

Another week, another challenge from Guido “Future Olive Farmer” Preite:

I created a plugin for one Online instance (version 8.2.2.1862),  I created a class library project with .NET 4.5.2 and with nuget I installed the Microsoft.CrmSdk.CoreAssemblies version 9.0.2.3

I registered the plugin and I always get this error:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.ArgumentNullException: Value cannot be null.

After checking the plugin code I decided to downgrade the nuget package to 8.2.0.2 and the plugin worked perfectly after. Beside the .NET 4.5.2, for Plugins, do we need to start to be careful to match the nuget version based on the Instance version? Or is it a bug in the latest SDK?

Solution

Nope, no bug, all is by design. You can’t get a more authoritative response than the one from Matt “SDK Deity” Barbour:

You cannot use a higher version of the SDK for a lower version of the server for plugins

Thus 8.x servers need to use 5 – 8.x assemblies. Where as 9.x servers need to use 5 – 9.x SDK assemblies.

(Facebook and Twitter cover photo by Alysa Bajenaru on Unsplash)

Leave a Reply

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