我需要加载同一DLL的两个版本,以便比较它们的输出.我假设我可以使用AppDomains,但我需要一些指导.
好吧,它实际上比我想象的容易得多.
原文链接:https://www.f2er.com/windows/371693.htmlm_Assembly1 = Reflection.Assembly.LoadFile(IO.Path.Combine(System.Environment.CurrentDirectory,"Old Version\Some.dll")) m_Assembly2 = Reflection.Assembly.LoadFile(IO.Path.Combine(System.Environment.CurrentDirectory,"New Version\Some.dll")) Console.WriteLine("Old Version: " & m_Assembly1.GetName.Version.ToString) Console.WriteLine("New Version: " & m_Assembly2.GetName.Version.ToString) m_OldObject = m_Assembly1.CreateInstance("FullClassName") m_NewObject = m_Assembly2.CreateInstance("FullClassName")@H_502_7@从现在开始,我使用后期绑定和/或反射来运行我的测试.