web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How can I access a CRM 2013 API from a .Net Core 2.0 console application?

(0) ShareShare
ReportReport
Posted on by

I have a Visual Studio 2017 solution that contains a .Net Core 2.0 console application. I need to access the API of an on-premises CRM 2013 system from the console application, so I created a .Net 4.0 class library in the same solution. In the class library I used Nuget to download Microsoft.CrmSdk.CoreAssemblies, which installed references to Microsoft.Xrm.Sdk and Microsoft.Crm.Sdk.Proxy. I added FetchXml-based data access code to the class library, referenced the class library project from the console application, and rebuilt the solution without errors.

 

But when I run the console application, I get the following run-time exception whenever the console application instantiates an object from the class library that contains a using statement for Microsoft.Xrm.Sdk:

 

Could not load file or assembly 'Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

 

I confirmed that the Microsoft.Xrm.Sdk.dll file is being copied to the bin sub-folder from which the console application is executing.

 

I’ve tried using different versions of Microsoft.CrmSdk.CoreAssemblies from 6.0.4 to 9.0.2.3, and I’ve tried those versions in combination with .Net 4.0, .Net 4.5, and .Net 4.5.2 versions of the class library, but I always get the same exception message.

 

Any suggestions about how I can access a CRM 2013 Api from a .Net Core 2.0 console application?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    David Jennaway Profile Picture
    14,065 on at

    If you have to use .Net 2.0 in the console application, then you'll need to access the CRM web services as a web reference to the Organization.svc web service. This is straightforward if you use AD authentication, but if you use Claims authentication it's a bit harder, though you can use the wsdlbasedproxies sample code in the SDK to do most of the work.

    Note that with a web reference, you don't get most of the helper code and collections that are in the Crm assemblies. However, you can get broadly equivalent code by following the steps in the 'Use the SOAP Endpoint for Web Resources with Silverlight' documentation in the SDK

  • Community Member Profile Picture
    on at

    Thank you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans