Announcements
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:
Yeah, Server version doesn't have TryGetValue. Except it was always there, pre-v9.1
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:
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"
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.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156