0

I have created a simple plugin for CRM Dynamics 2013 (on premise) which references System.Net.Http.Formatting for HttpClient to PostAsJsonAsync to a web api service. However, when it runs I get the error:

Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I have checked that Copy Local is set to True.

Infuriating! Any ideas?

MightyAtom
  • 331
  • 4
  • 24

2 Answers2

0

Although I haven't proved it I think this is Dynamics CRM plugin issue. I think all referenced assemblies need to be installed in the CRM GAC or merged into one dll using ILMerge. See: Plugin with references not working on CRM 2011

Community
  • 1
  • 1
MightyAtom
  • 331
  • 4
  • 24
  • I haven't used that exact library in a Plugin but I'm guessing it is not installed into the GAC when the .NET framework is deployed. If it is then it is possible that the version in the GAC is not the version referenced in your project. If it is not in the GAC you will need to merge it into the Plugin DLL to get it to work. You can read over my blog post for an easy way to get NuGet working for Plugin development: http://nicknow.net/dynamics-crm-ilmerge-dll-plugin/. – Nicknow Feb 05 '15 at 15:31
0

When you deploy the plugin, use run from disk instead of database