Skip to content
●
Microsoft-Focused Solutions & Delivery
|
Dynamics 365 · Business Central · Power Platform
|
Global Delivery · UAE Presence
Core Microsoft Platforms

Sales, Customer Service, Project Operations

ERP & CRM Integration, APIs & Data Workflows

Power Apps, Automate, BI, Pages & Dataverse

Specialist Services

APIs, Azure Logic Apps, Webhooks & SQL

8-Step Controlled Validation & Relational Mapping

Copilot Studio, Governed Pilots & Agents

Health Checks, Workflow Fixes & Rescues

SkySoft Standalone Software
InspectionsTrack ↗

Digital inspection and reporting software for industrial operations.

SkySoft Compliance ↗

Digital QSE and compliance workflows for construction teams.

Confidential delivery capacity behind your partner brand

Senior specialists for project teams and ongoing backlogs

SkySoft Insights

How to Merge External DLLs (Like Twilio) for Dynamics CRM Plugin Deployment

[fusion_builder_container type=”flex” hundred_percent=”no” equal_height_columns=”no” menu_anchor=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” background_color=”” background_image=”” background_position=”center center” background_repeat=”no-repeat” fade=”no” background_parallax=”none” parallax_speed=”0.3″ video_mp4=”” video_webm=”” video_ogv=”” video_url=”” video_aspect_ratio=”16:9″ video_loop=”yes” video_mute=”yes” overlay_color=”” video_preview_image=”” border_color=”” border_style=”solid” padding_top=”” padding_bottom=”” padding_left=”” padding_right=””][fusion_builder_row][fusion_builder_column type=”1_1″ layout=”1_1″ background_position=”left top” background_color=”” border_color=”” border_style=”solid” border_position=”all” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” center_content=”no” last=”true” min_height=”” hover_type=”none” link=”” border_sizes_top=”” border_sizes_bottom=”” border_sizes_left=”” border_sizes_right=”” first=”true”][fusion_text]

Overview

When developing a custom plugin for Microsoft Dynamics 365 CRM, using third-party libraries like Twilio often becomes necessary — for instance, to generate JWT tokens for voice/video communication. However, Dynamics CRM only accepts a single strong-named (signed) DLL for plugin assemblies, and external libraries like Twilio come as separate DLLs that are not strong-named by default.

This blog explains how to:

  • Create a CRM plugin project
  • Add and use the Twilio library
  • Handle strong-naming issues
  • Merge or substitute external libraries
  • Deploy to CRM using Plugin Registration Tool

Step 1: Create a New Folder for the Plugin in local directory

Create a folder to hold your plugin source code.

Merge Twilio DLL in Dynamics CRM Plugin Easily

Step 2: Open Command Prompt and Navigate to the Folder

Use CMD and navigate to the folder you created:

cd path\to\your\folder

Step 3: Initialize the Plugin Project

Run this command to scaffold a plugin project:

pac plugin init

This generates the following files:

Merge Twilio DLL in Dynamics CRM Plugin Easily

Once you run the above command the project will be created successfully.

Note: If the Microsoft powerflate form CLI is not installed we have to install before creating the Project
we just need to run below command in CMD

dotnet tool install global Microsoft.PowerApps.CLI.Tool

After installation, verify by running:

pac –version

dotnet tool install global Microsoft.PowerApps.CLI.Tool

Step 4: Rename the Plugin Class File

Open the solution in Visual Studio and rename Plugin1.cs to GenerateTwilioTokenPlugin.cs. Update the class name and namespace accordingly.

Step 5: Add Twilio NuGet Package

Open NuGet Package Manager and install:

Twilio

These libraries are required to generate a Twilio token.

Add Twilio NuGet Package

 Step 6: Add Plugin Code

Paste the following code in your plugin class:


using Microsoft.Xrm.Sdk;

using System;

using System.Collections.Generic;

using Twilio.Jwt.AccessToken;

namespace Xrm.Plugin.Twilio

{

    public class GenerateTwilioTokenPlugin : PluginBase

    {

        public GenerateTwilioTokenPlugin(string unsecureConfiguration, string secureConfiguration)

            : base(typeof(GenerateTwilioTokenPlugin))

        {

        }

        // Entry point for custom business logic execution

        protected override void ExecuteDataversePlugin(ILocalPluginContext localPluginContext)

        {

            if (localPluginContext == null)

            {

                throw new ArgumentNullException(nameof(localPluginContext));

            }

            var context = localPluginContext.PluginExecutionContext;

            string identity = “crm_user_” + Guid.NewGuid().ToString().Substring(0, 8);

            var accountSid = “ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”;

            var apiKey = “SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”;

            var apiSecret = “JLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”;

            var appSid = “AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”;

            var grant = new VoiceGrant

            {

                OutgoingApplicationSid = appSid,

                IncomingAllow = false

            };

            var token = new Token(accountSid, apiKey, apiSecret, identity, grants: new HashSet<IGrant> { grant });

            var jwt = token.ToJwt();

            context.OutputParameters[“TwilioToken”] = jwt;

        }

    }

}

Step 7: Strong-Named Assembly Error

When you try to register the plugin in CRM, you may encounter this error:

Could not load file or assembly ‘Twilio.Jwt.AccessToken, Version=…’. A strongly-named assembly is required.

This is because:

  • CRM requires all plugin DLLs to be strong-named
  • Twilio’s NuGet DLLs are not strong-named
Step 7: Strong-Named Assembly Error

Step 8: Fixing Strong-Naming Issues

Step 8.1: Sign Your Plugin Assembly

In Visual Studio:

  1. Right-click on the project → Properties
  2. Go to the Signing tab
  3. Check Sign the assembly
  4. Create or select a .snk key file
Dashbaord showing how to Sign Your Plugin Assembly

Step 8.2: Use Strong-Named Versions of Dependencies

Instead of using ILRepack, install strong-named versions of the required libraries. For example:

You can download the Strong-Name Signer tool directly from NuGet:

Install-Package StrongName

Step 8.3: Merge DLLs

After building the plugin project, use ILRepack to combine your plugin DLL and the Twilio DLLs into one strong-named assembly:

Ensure all referenced DLLs are included in the merge command.

 Step 9: Deploy to Dynamics CRM

Now, register the MergedPlugin.dll using the Plugin Registration Tool:

  1. Connect to your environment
  2. Open Power Apps and create and empty Solution
Sign Your Plugin Assembly
  1. Open Plugin Registration Tool in XRM
  2. Click on register new Package
  1. Choose the Nuget package created from the Project and select the solution we have created
  1. Complete registration and bind it to a step/action
Merge Twilio DLL in Dynamics CRM Plugin Easily

Conclusion

Integrating third-party libraries like Twilio in Dynamics CRM plugins can be tricky due to strong-naming constraints. However, with the right setup:

  • You can develop powerful plugins
  • Sign them appropriately
  • Use strong-named versions of dependencies
  • Simplify deployment using .nupkg packages

Once deployed, your custom plugin can be triggered via JavaScript, Custom Actions, or Workflows—unlocking Twilio-powered communication features within your CRM.

Read more : data governance in dynamics 365 made simple

FAQ’s

Can I use third-party libraries like Twilio in Dynamics CRM plugins?

Yes, but you must merge them into a single strong-named DLL before deployment.

Why am I getting a ‘strong-named assembly required’ error?

Dynamics CRM only accepts strong-named plugin assemblies, but Twilio doesn’t sign its DLLs by default.

How do I merge external DLLs for CRM plugin deployment?

Use ILRepack to combine your plugin DLL with Twilio’s DLLs into a single signed assembly for CRM deployment.

[/fusion_text][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]