D365 v9.x: Step by Step Guide on how to create a simple console application for Dynamics 365.
Introduction
In this blog, we will see how to create a simple console application which will connect to dynamics 365.
Prerequisite
- Dynamics 365 account with Administrator role
Click here to know how to create trial for D365 account.
Description
As per the Microsoft documentation, we should always use Xrm tooling/Web API library when connection to Dynamics 365 from an external application. The external application can be Console app or Web App hosted outside D365.
I will also share the blog on how to connect D365 using Web API but for now, let’s focus on how to create a first/simple console application using Xrm tooling.
Steps
- Open a visual studio and create a new project
2. Add Dynamics 365 referances using NuGet package manager

Type ‘D365 Xrm Tooling‘ in the search box. Make sure you select a correct library as ‘Microsoft.CrmSdk.XrmTooling.CoreAssembly‘
Add connection string in App.config file. Please update URL, Username and Password in the connection string.
<connectionStrings>
<!-- Online using Office 365 -->
<add name="D365ConnectionString"
connectionString="Url=https://dreamlandhome.crm.dynamics.com; Username=admin@dreamlandhome.onmicrosoft.com; Password=Pass@123; authtype=Office365"/>
</connectionStrings>
Right click on References and Click on “Add Reference“
Please find code on GitHub
using Microsoft.Xrm.Tooling.Connector;
using System;
using System.Configuration;
namespace D365SimpleConsoleApp
{
class Program
{
private static CrmServiceClient _crmServiceClient;
static void Main(string[] args)
{
using (_crmServiceClient = new CrmServiceClient(ConfigurationManager.ConnectionStrings["D365ConnectionString"].ConnectionString))
{
if (_crmServiceClient.IsReady)
{
Console.WriteLine("Authenticated To D365.");
}
else
{
Console.WriteLine("Authentication Failed.");
throw _crmServiceClient.LastCrmException;
}
}
}
}
}
Cheers
![]()
![]()
We have successfully created a console app for Dynamics 365.
This was originally posted here.

Like
Report
*This post is locked for comments