简体   繁体   English

如何在.Net Core 3.1 中创建 CrmServiceClient 实例?

[英]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.

相关问题 在.Net Core 3.1中创建一个HttpRequest实例 - Create a HttpRequest instance in .Net Core 3.1 如何在 C# .net Core 3.1 中实例化一个 Logger - How to instance an Logger in C# .net Core 3.1 如何在 ASP.net 核心 3.1 中创建新的 session id? - How to create a new session id in ASP.net core 3.1? 如何在 Asp.Net Core 3.1 上创建两种类型的用户 - How to create two types of users on Asp.Net Core 3.1 如何在 .net 核心 web api 3.1 中创建 Customtom 授权属性? - How to create Customtom Authorize Attribute in .net core web api 3.1? 如何在 ASP.NET Core 3.1 中获取服务的实例 - How do I get a instance of a service in ASP.NET Core 3.1 .NET Core 3.1 框架提供 DI - 如何获取已注册类型的实例? - .NET Core 3.1 framework provided DI - how to get the instance of already registered type? 如何在 app.UseEndPoints 中将自定义路由操作作为委托实例添加到 ASP.NET Core 3.1 应用程序? - How to add custom routed action as a delegate instance to ASP.NET Core 3.1 app in app.UseEndPoints? 如何注册具有多个接口的服务并将该服务用作 ConfigureServices.Net Core 3.1 中的单个实例 - How to register a service having multiple interfaces and use that service as a single instance in ConfigureServices .Net Core 3.1 如何使用 EF Core 在 .NET Core 3.1(无 LINQ)中为 CRUD 操作创建自定义扩展方法? - How to create custom Extension Method for CRUD operation in .NET core 3.1 (without LINQ) using EF Core?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM