web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Could not load file or assembly 'Newtonsoft.Json

(0) ShareShare
ReportReport
Posted on by 195

Hi friends,

I have written code which consumes public API's like countries. When I pass country code it will returns country name, in console it is returning country but when i use the same code in plugin it is throwing exception "Could not load file or assembly 'Newtonsoft.Json ". I tried changing app.config and ILMerge too but no use. Please help me to solve this issue. I am unable to debug the plugin either because of this exception.

Thanks,

Bharath

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    Hi, you need to merge your plugin with 3rd party dll. I wrote a blog post about this.

    temmyraharjo.wordpress.com/.../dynamic-crm-merge-assemblies

    Hopefully can help you to merge the dll.

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    You need to confirm that the version of "Newtonsoft.Json" you referenced should be the same as the on running in your environment.

    Please refer to the following links.

    1.How to reference assemblies from plug-ins

    blogs.msdn.microsoft.com/.../how-to-reference-assemblies-from-plug-ins

    2.Same resolved issue

    community.dynamics.com/.../292180

    Hope it helps.

    Best Regards

    Leo

  • Suggested answer
    Ben Thompson Profile Picture
    6,350 on at

    You really shouldn't be using ILMerge www.develop1.net/.../ILMergeNotSupported shows why and also provides you with replacement standard .Net 4.0 code that will perform the same functionality that you are using Newtonsoft for...

  • jmurphy Profile Picture
    5 on at

    Its silly that its 2020 and Microsoft hasn't included this assembly with the core product. Especially since almost every other azure cloud offering has this package readily available (example: Azure API Management).

    The "supported" approach of using DataContractJsonSerializer is riddled with bugs and limitations:

    - Dates serialize to non-standards format unless you include a format class

    - ANSI characters fail to serialize properly

    - The inability to serialize and de-serialize loosely defined JSON object schemas without known types (which is a necessity for Azure Cognitive Services)

    I would do yourself a favor and:

    - Get the nuget packages MSBuild.ILMerge.Task, and Newtonsoft

    - Set the "Copy Local" property for CRM classes to "False"  (Microsoft.Crm.Sdk.Proxy, Microsoft.Xrm.Sdk, Microsoft.Xrm.Sdk.Workflow)

    - Set the "Copy Local" property for Newtonsoft to "True"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans