Microsoft Dynamics 365 SDK Core Assemblies .NET Core Porting Error

前端 未结 2 893
天涯浪人
天涯浪人 2021-02-19 15:51

When trying to use Microsoft Dynamics 365 SDK Core Assemblies in a .NET Core 2.0 project, the following error occurs at runtime simply by using Microsoft.Xrm.Sdk:

相关标签:
2条回答
  • 2021-02-19 16:30

    I had the same issue and it got resolved when I selected template Console Application (.Net Framework) in Visual Studio instead of Console Application (.Net Core).

    0 讨论(0)
  • 2021-02-19 16:38

    I tried all possible things and can say that SDK, ServiceModel etc are not compatible with .net core and never will be, according to multiple discussions on github. However, i was able to do this:

    • Use XrmToolBox and crmsvcutil.exe to generate models (optional)
    • place them in netstandard2 project
    • reference XRM SDK from nuget
    • SDK works under .net core in part where LINQ queries and raw QueryExpressions are translated to subclasses of OrganizationRequest
    • write custom IOrganizationService which serializes OrganizationRequests and sends them to some other app
    • Other app is .net core web api which references that project and XRM SDK, but runs on full framework on windows and executes actual requests, serializes responses and sends them back.

    IMPORTANT EDIT: I found out that SDK 2016 doesn't work reliably in .net core on linux due to various reasons, and stopped at 2011 (nuget package is Microsoft.Xrm.Sdk.2011). It works fine except in one case: whe you do context.AddObject and pass an Entity with no ID. SDK relies on p/invoking native Windows library to create sequential UUID and crashes on Linux. You can overcome this by setting ID prior to calling .AddObject().

    0 讨论(0)
提交回复
热议问题