Using Dynamics CRM SDK with .NET Core

There is a distinction to be made between applications that use the .NET Core runtime vs. the .NET Core framework. As you've found out, the Dynamics 365 SDK does not currently work with the .NET Core runtime, however it does work with the .NET Core framework when the .NET Core project targets the .NET Framework runtime using the .NET Framework's target framework moniker (TFM) setting in the project file. For example with a .NET Core console application, the .csproj file would look like this (notice the TargetFramework):

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.CrmSdk.CoreAssemblies" Version="9.0.2.5" />
  </ItemGroup>

</Project>

Such applications will not be cross-platform and only be executable on Windows, but still allows for the use of other .NET Standard class libraries and frameworks such as ASP.NET Core that implement .NET Standard while executing on the .NET Framework runtime. Eventually if the Dynamics 365 SDK is ever updated to work on the .NET Core runtime, the project file's target framework monitor value can be changed to .NET Core and become cross-platform.


You should try the new CDM SDK. It uses .NET Core and supports Dynamics CRM 365. https://www.nuget.org/packages/Microsoft.PowerPlatform.Dataverse.Client

Just remember to replace:

new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString);

With this:

new Microsoft.PowerPlatform.Dataverse.Client.ServiceClient(connectionString);

Make sure you select Include prerelease. Package Management Screen