I have an interesting situation and am trying to do something that I'm not even sure is possible.
I have a .NET 2.0 project that via reflection loads an assembly, and calls a specific method on that assembly. We are looking at moving forward and starting to use .NET 3.5 in the environment, but want to minimize risk with regard to this "host" application. Therefore we were trying to load the .NET 3.5 assembly from the .NET 2.0 project, since 3.5 is an extension of the 2.0 framework, etc.
Well, in doing this we get the following error:
The format of the file 'MyDllNameHere.DLL' is invalid
So, from the looks of this it isn't possible. Can anyone confirm this? Is there a workaround?
Then a second question, if it isn't possible, can we recompile the host under .NET 3.5 and then have it load .NET 2.0 assemblies via reflection?
You can't load 3.5 assemblies in 2.0, because they may reference stuff that didn't exist in the 2.0 framework.
You can do the reverse like you mentioned though, 3.5 should load 2.0 assemblies with no problems.