I would like to download the DLL file (Test.dll) as an assembly. I can do this using both Visual Studio direct links (e.g. loading the dll as a link to my C # application) and loading the dll using the method Assembly.LoadFile(filename). Now I would like to add my DLL file as an embedded resource to the Visual Studio application and load the DLL file as an assembly. I know how to load this resource as a byte array, is there some correlation between the byte array and the assembly that I could use? In addition, I need to be able to call a method located in a DLL file. See the code below - this will once again explain what I'm doing.
Assembly SampleAssembly = Assembly.LoadFrom("WindowsFormsApplication2.ThisisaTESTDLL.dll");
Type myType = SampleAssembly.GetTypes()[0];
MethodInfo Method = myType.GetMethod("myVoid");
object myInstance = Activator.CreateInstance(myType,null);
Method.Invoke(myInstance,new object[] { "param1", "param1"});
If I am missing something here, please let me know and I will edit the original post.
user725913
source
share