Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

Microsoft.Xrm.CoreAssemblies 9.0.2.45 comes with System.Text.Json that comes with many dependencies. How to use latest Microsoft.Xrm.Sdk?

Posted on by 213

So I want to update CoreAssemblies to 9.0.2.45. But since 9.0.42 it depends on System.Text.Json, which has lots of dependencies:

So now I want to deploy this plugin, that depends on latest CoreAssemblies. I have CRM 9.1 On-Prem May 2022 Update: 9.1.0010.0102. I try out some action and get some error from my plugin (that is not actually related to those dependencies but is related issue)

>System.MissingMethodException: Method not found: 'Boolean Microsoft.Xrm.Sdk.ParameterCollection.TryGetValue(System.String, !!0 ByRef)'.
>   at DEAC.CRM.CRM.Main.Plugin.EmailTicketCreate.OnPreCreate(IServiceProvider serviceProvider)
>   at DEAC.CRM.Plugin.BasePlugin.Execute(IServiceProvider serviceProvider): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #C7310F1D

Alright, the relevant line:

if (localContext.PluginExecutionContext.ParentContext.SharedVariables.TryGetValue("sssUserId", out object sssUserIdObject)) {

Hmm, let's see how "C:\Program Files\Dynamics 365\CRMWeb\bin\Microsoft.Xrm.Sdk.dll" compares with what NuGet gave me:

  • CRM Server:  [assembly: AssemblyVersion("9.0.0.0") [assembly: AssemblyFileVersion("9.0.46.7901") 
  • NuGet:  [assembly: AssemblyVersion("9.0.0.0") [assembly: AssemblyFileVersion("9.2.47.9489") - So nuget is newer

Yeah, Server version doesn't have TryGetValue. Except it was always there, pre-v9.1

2022_2D00_07_2D00_19-12_5F00_06_5F00_37.png

I don't know when that method disappeared, it was there pre-9.1 and is even documented: ParameterCollection.TryGetValue<T>(String, T) Method (Microsoft.Xrm.Sdk) | Microsoft Docs - however the question is more about how can I use the latest CoreAssemblies with baggage of dependencies? I don't see System.Text.Json.dll or any other of those dependencies in C:\Program Files\Dynamics 365\CRMWeb\bin and I don't see them referenced in in C:\Program Files\Dynamics 365\CRMWeb\bin\Microsoft.Xrm.Sdk.dll:

2022_2D00_07_2D00_19-16_5F00_19_5F00_58.png


Thus I don't even think that I'll be able to do without ILMerging those dependencies.

Does Microsoft really pushes us to use a tool they officially do not support? (ILMerge). Using these nuget packages is something microsoft officially recommends: Choose your development style for Dynamics 365 Customer Engagement (Developer Guide for Dynamics 365 Customer Engagement (on-premises)) | Microsoft Docs and a quote directly from there:

You should use the latest version of the SDK assemblies to create your plug-ins, custom workflow activities, or XAML workflows. Starting with version 9.x, you should use .NET Framework version 4.6.2.

 

On the one side, I am broken without using ILMerge and I am screwed using ILMerge. So I now instruct my build to ILMerge Microsoft.Xrm.Sdk with the newly added dependency System.Text.Json and I get:

Unresolved assembly reference not allowed: System.Text.Json.

No problem, we have a solution for that. Except it doesn't work.

What am I doing utterly wrong?

P.S. I also see that there is a transition from Microsoft.Xrm.CoreAssemblies to Microsoft.PowerPlatform.Dataverse.Client as written in Transition client applications to Dataverse ServiceClient - Power Apps | Microsoft Docs however it does not apply to on-prem, quoting: "On-premise applications - this article is not for you, yet"

  • Suggested answer
    Guido Preite Profile Picture
    Guido Preite 54,063 Moderator on at
    RE: Microsoft.Xrm.CoreAssemblies 9.0.2.45 comes with System.Text.Json that comes with many dependencies. How to use latest Microsoft.Xrm.Sdk?

    if you just need to write plugins AND you are onpremise you can just use a previous nuget package, you don't need to use the latest.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans