CRM and .NET Framework version, choose wisely !

Hello everyone,

I faced an unwanted issue lately. I was creating a new Plugin project for testing purpose.
My Visual Studio is configured to create new project using .NET Framework version 4.6.1.

So far nothing weird, you will tell me.

Back to my testing, the goal was just to create a simple plugin which was throwing an exception and that's it. When testing it, I realized that the Exception thrown was not "consistent". Sometimes I had indeed my Exception message sometimes I had something like :

Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object)

Here is a sample of the exceptions thrown "randomly" :

  • The exception saying : "go to catch" is my wanted exception (the small one)
  • the other, detailed above, is not welcomed :-)

After few researches and help, I ended up on Scott's blog post 1.

As Scott says, you need to be careful regarding the .NET framework version you choose while creating your plugin project.

I wanted to add a slight information here (Thanks to Daryl 2), here are the details of .NET framework version you choose use as for now :

  • Online (plugins) : 4.5.2 (as only this version is installed on Azure CRM servers)
  • XRMTooling : 4.6.1 or 2 (to connect to CRM externally)

Hope this will save you some times !
Happy CRM'in

Clement

Dynamics 365 CRM & Power Platform addict.