C# Load different versions of assembly to the same project

后端 未结 3 861
失恋的感觉
失恋的感觉 2020-12-20 16:27

I\'m creating some tool what performs several operations like NUnit. Inside this tool I open .dll assembly and invoke methods form it to run some test.

Everything

3条回答
  •  情深已故
    2020-12-20 16:51

    Try like this:

    string dllFile = "C:\\sample.dll";
    Assembly asmLoader = Assembly.LoadFile(dllFile);
    Type[] types = asmLoader.GetTypes();
    

    Since all resources from the assembly cannot be reloaded/replaced it's assembly resources while application is still running. It will only be replaced/removed when application is unloaded or the that Assembly that holds it.

    Use LoadFile() method. Hope it helps.

提交回复
热议问题