AppDomain CreateInstanceAndUnwrap w/ Visual Studio 2008
I recently converted a project form Visual Studio 2005 to Visual Studio 2008 RTM. I am using AppDomain.CurrentDomain.CreateInstanceAndUnwrap to dynamically create an instance similar to the following
string assembly = "Test.dll";
string type = "Test.MyClass";
MyClass obj = AppDomain.CurrentDomain.CreateInstanceAndUnwrap(assembly, type) as MyClass;
This worked fine in 2005 but gets an exception in 2008 - "could not load file or assembly or one of it's dependancies". Looking at the fusion log, which is now in the exception info window in Studio (very nice), I could see that it was looking for Test.dll.dll, Test.dll.exe. So, the extension is being appended to the end of the assembly name. After removing ".dll" from the name of the assembly, the code works fine.
string assembly = "Test.dll";
string type = "Test.MyClass";
MyClass obj = AppDomain.CurrentDomain.CreateInstanceAndUnwrap(assembly, type) as MyClass;
This worked fine in 2005 but gets an exception in 2008 - "could not load file or assembly or one of it's dependancies". Looking at the fusion log, which is now in the exception info window in Studio (very nice), I could see that it was looking for Test.dll.dll, Test.dll.exe. So, the extension is being appended to the end of the assembly name. After removing ".dll" from the name of the assembly, the code works fine.