Microsoft Dynamics 365 SDK Core Assemblies .NET Core Porting Error
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()
.