-1

I have add one dll as embedded resource in my windows forms application. I got code how to use embedded dll in my windows forms application.

This code used:

   public PanContext() : base("ConnectionString")
        {               
            string modbus = "PLCBots.Services.NModbus4.dll";
            EmbeddedAssembly.Load(modbus, "NModbus4.dll");    
        }

now got a problem that my embeddded reourcs is load multiple time and i got error An item with the same key has already been added.

Is any thing in windows forms application like DependencyRegister.cs file we have in ASP.NET MVC ?

Please guide me so my above written code will not call again & again.

1 Answers1

0

AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { return EmbeddedAssembly.Get(args.Name); }

User this in you main startup point of application