Let’s try Dataverse Dependent Assemblies for Plug-ins

For a long time, Developers for Dataverse don’t have an official way to use third-party libraries when creating plugin(s). If we want to reuse existing code, the only official way to do it was use the Shared Project which is limited to the code that we own + the IntelliSense in Visual Studio not working as I would expect it to be. The unofficial way is using ILMerged/ILRepack to merge all the necessary DLL(s) into a single DLL (we can use any library that we want. But deploying/setting the project for the first time is kinda hard). And finally, for today’s topic, we will try the new official way + easier steps through Dataverse Dependent Assemblies for Plug-ins (PREVIEW)!

Please take note there are some limitations that you need to know (not supporting On-Premise at this moment, the Dependent Assemblies must be under 12MB, only works for Plugin) that you can check in this documentation.

Plugin Registration Tools v9.1.0.155

To try this Preview, we need to update/download Plugin Registration Tools at least v9.1.0.155. The easiest way to do this is to go to the official NuGet Package of Plugin Registration Tools here, and then click the “Download Package” link:

Click the Download Package link

Once downloaded, you need to rename the extensions to zip > right click > Properties > Unblock the file (I forget to do this and when clicking the Register New Assembly button, it will not work) > unzipped the files > go to tools folder to get all the Plugin Registration Tool.

Unblock the zip to avoid problems in the later step


For today’s demonstration, I’ll create a plugin that will use Niam.Xrm.Framework (Dynamics CRM Plugin framework). So without further ado, let’s create Plugin Project using Microsoft Power Platform CLI (if you haven’t installed it, you need to check this documentation)/run the command “pac install latest” to update the tools to version at least Microsoft.PowerApps.CLI.1.16.6.

First, you need to set up the working directory that you want. Once you do that, open command prompt > CD to your working directory > run the “pac plugin init” command:

Create Plugin Project using PAC command

Once created, you now can open the project (.csproj) > install Niam.Xrm.Framework using below Package Manager command:

Install-Package Niam.XRM.Framework -Version

Because of Niam.Xrm.Framework is a plugin framework, we can delete the generated files and create our custom Plugin directly. Below is the sample code that I use for this demonstration:

using System;
using Microsoft.Xrm.Sdk;
using Niam.XRM.Framework.Interfaces.Plugin;
using Niam.XRM.Framework.Plugin;
namespace TryDependentAssembly
    public class SetContact : OperationBase
        public SetContact(ITransactionContext<Entity> context) : base(context)
        protected override void HandleExecute()
            var jobtitle = $"CRM Developer '{Get<string>("firstname")} " +
            Set("jobtitle", jobtitle);
            Set("firstname", "Temmy");
            Set("lastname", "Raharjo");
    public class DemoPlugin : PluginBase<Entity>, IPlugin
        public DemoPlugin(string unsecure, string secure) : base(unsecure, secure)
        protected override void ExecuteCrmPlugin(IPluginContext<Entity> context)
            new SetContact(context).Execute();

From the above code, we will set the First Name as “Temmy”, and the Last Name as “Raharjo”. Then for the Job Title, we will set it as a combination of the “CRM Developer” + First Name + Last Name that we inputted from UI (for simplification purposes I choose this scenario).

Next, you need to open your .csproj and add property PrivateAssets=”All” to all references except Niam.Xrm.Framework (thanks to this Forum thread – shout out to user name eleung83):

Add PrivateAssets=”All” to all the references that you don’t need

If you don’t do the above step, you will get an error “PluginPackage can not contain Microsoft.CrmSdk.Core.Assemblies” when registering/updating the PluginPackage.

Now, we need to open the Plugin Registration Tool > connect to the environment you want > click Register > click Register New Package > set the Plugin package file to .nupkg file that is automatically generated inside bin/debug or bin/publish of your plugin project:

The NuGet package generated for Plugin Project

Set the Solution to the solution that you want it > click Import:

Register a new Plugin Package

Once created, you can register your plugin step. For this demonstration, I use the below settings:

Registered the plugin assembly

After registering, go to the Plugin > Register new step > for this demonstration I’ll use the below settings:

Create Plugin Step


Demo time

Happy CRM-ing!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.