Deploying a multiple assembly plugin

Lets take a simple example for it !!

Suppose this is our Pre-Update Plugin

public void Execute(IPluginExecutionContext context)
Calculate myCalculate;
DynamicEntity entity = (DynamicEntity)context.InputParameters[ParameterName.Target];
if (entity.Name == EntityName.lead.ToString())
// Get the Last Name string
String lastName =(string) entity.Properties[“lastname”];
// Call the function within the assembly
myCalculate = new Calculate();
// Assign the value back
entity.Properties[“lastname”] = lastName;
This plugin would update the value for lastname field for
the lead record on pre update. It is making use of a 
custom function which is there in some other assembly.
The function is a simple function which would replace the
char ‘s’ with ‘m’
public class Calculate{public string ReplaceCharSwithN(string a){

return a.Replace(‘s’, ‘n’);




If we register the above plugin without putting Calculate class’s assembly in GAC, we would get the following error

Count not load the file or assembly ‘Calculator’ or one of its dependencies”

Here we need to put the referenced assembly in the GAC,

followed by an IISReset.

Or the other option with us is to use ILMerge tool. Using it we can combine multiple .NET assemblies into one.

Download and find more information about the tool here

Using the following command we can merge multiple assembly into one

ilmerge /keyfile:g.snk Test.dll Calculator.dll /out:ILMergedLibrary.dll

keyfile –> valid key file

Test.dll—> the plugin’s dll

Calculator.dll—> the custom assembly.

ILMergedLibrary.dll –> The resulting assembly.

And register this newly merged assembly.




Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

Please share your thoughts

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

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

Google+ photo

You are commenting using your Google+ 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.