|
I have created a dll named myInterface.DLL that interfaces between my application and a 3rd party application. To do this I Added a reference to their Interop.3rdParty.dll and added an “Imports 3rdParty”. Everything works great. They released version 2 of the 3rd party app and added renamed their interops and name spaces. So What I am forced to do is create a new dll, myInterface_V2.DLL. This DLL is an exact copy of the myInterface.DLL with the exception of the what dll’s are referenced and the Imports directive changed to “Import CompanyName.3rdParty “ . Inside my DLL’s I have 3 forms and 2 Classes and as I stated above the only the only difference between my 2 dll’s is the “Imports” statement. So now my calling application checks to see what version of the 3rd party app the user has and calls the appropriate form in the appropriate DLL. So my question Without duplication the 3 forms and 2 classes is there a way to dynamically change the “Imports” statement, or can anyone suggest a way of doing this where I do not have so much duplicate code. I am hating the fact that every time I update the dll I have to duplicate it somewhere else. This is a vb.net dll and I am using VS2010 and a Windows 7 box.
Thanks in advance
Paul
-- modified 18-Dec-12 16:40pm.
|
|
|
|
|
You can't change the references during runtime, but you can load another assembly, load it's types and use them. Google for "reflection" and "Assembly.Load", there should be some examples out there.
|
|
|
|