How to add an assembly resolve event delegate to overcome WorkflowGen.My dependency issue when deploying custom assembly SDK workflow application


#1

Note: This article applies to WorkflowGen.My 3.1.0 and earlier.

When your custom assembly fails to load the required WorkflowGen.My version, you can catch this event and instruct your assembly to use the local WorkflowGen.My version found in the current WorkflowGen executable \bin folder.

C# example

  1. Add a using directive to System.Reflection in your class file.

  2. Add a delegate to the AssemblyResolve event in the constructor of your class.

    // Constructor of the class MyAssembly
     public MyAssembly()
     {
         AppDomain.CurrentDomain.AssemblyResolve += delegate (object sender, ResolveEventArgs e)
         {
             if (e.Name != null && e.Name.StartsWith("WorkflowGen.My"))
             {
                 return Assembly.Load("WorkflowGen.My");
             }
             else
             {
                 return null;
             }
         };
     }
    

Considerations when deploying a custom assembly SDK workflow application