Writing Dynamics 365 C# code can unlocks many possibilities within the platform. Writing C# code that can be used to update data in Dynamics (Dataverse). It helps with integration scenarios like connecting external systems with Dynamics. One of the challenges we usually face is the dependency on the .NET version that Dynamics uses. Currently, .NET 4.6.2 is required and there are many dependencies. These dependencies can cause problems in large projects. Even for simple C# application, the list of dependencies is very large. What’s worse, one of the dependencies Microsoft.IdentityModel.Clients.ActiveDirectory is deprecated.
How do we get around so many dependent packages? What if we want to run our code under a newer .NET version like 6.0 or .net core 3.1? The good news is that we now have a great solution called Dataverse Client. The code is available on: GitHub PowerPlatform DataverseServiceClient
What’s really nice is that there are only two dependencies to run a simple console application:
Here is a sample CRUD program that connects to Dynamics 365, then create an account, read the account, update it and then delete it.
Create an appsettings.json file in Visual Studio and set the file to copy to output directory: