[英]How to create CrmServiceClient instance in .Net Core 3.1?
I tried this code:我试过这段代码:
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Tooling.Connector;
var connectionString = @"AuthType = Office365;
Url = https://myorg.api.crm8.dynamics.com/XRMServices/2011/Organization.svc;Username=user@azureresulticks.onmicrosoft.com;Password=***";
CrmServiceClient conn = new CrmServiceClient(connectionString);
IOrganizationService service;
but I'm getting this error:但我收到此错误:
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. System.IO.FileNotFoundException:“无法加载文件或程序集‘System.ServiceModel,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089’。 The system cannot find the file specified.'该系统找不到指定的文件。'
on trying to create the CrmServiceClient
instance.在尝试创建CrmServiceClient
实例时。
The same piece of code was working in .NET framework versions.同一段代码适用于 .NET 框架版本。
But this time, I have to use .NET Core.但是这次,我不得不使用 .NET Core。
Microsoft.CrmSdk.XrmTooling.CoreAssembly
is a NuGet package built on .NET Framework 4.6.2. Microsoft.CrmSdk.XrmTooling.CoreAssembly
是一个 NuGet package 构建于 .NET Framework 4.6.2 之上。 It is not compatible with .NET Core.它与 .NET 核心不兼容。
When connecting with Dynamics 365 CE from a .NET Core project, try package Microsoft.PowerPlatform.Dataverse.Client
.从 .NET Core 项目连接 Dynamics 365 CE 时,请尝试 package Microsoft.PowerPlatform.Dataverse.Client
。 It is pretty new and designed for .NET Core and Dynamics 365 Online.它非常新,专为 .NET Core 和 Dynamics 365 Online 设计。
See also:也可以看看:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.