.NET: Load two version of the same DLL

前端 未结 3 1679
我在风中等你
我在风中等你 2020-12-19 01:35

I need to load two versions of the same DLL in order to compare their outputs. I assume that I can use AppDomains for this, but I need some guidence.

3条回答
  •  粉色の甜心
    2020-12-19 02:20

    Here is a guide to do that:

    extern alias oldVer;
    extern alias newVer;
    

    and when you compile:

    csc /r:oldVer=Somepath\ClassLibrary.dll /r:newVer=AnotherPath\ClassLibrary.dll program.cs
    

    or in Visual Studio change the "aliases" field in the property tab of your project references alt text

提交回复
热议问题