As you know , we can run executable .net application on different .net CLR versions using application config file ( for example MyProject.exe.config ) by following content :
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
i search for this trick to use it on .Net DLL files but nothing found , i test it using config file like MyDLL.dll.config , at the begining i think CLR do not use my dll config file ( my DLL builded using .Net framework 2 and on my VM i have just .Net Framework 4 ) when i run my native application that use .Net DLL , it throw the exception : Can't find CLR version or something like this .
in my test process i see a strange encounter , if my DLL build using .Net Framework 4 and run it on VM's windows , it run properly ( VM's windows has .Net 4 and it's normal behavior ) , but if i put a config file inside my DLL ( MyDLL.dll.config ) and put the following content in it , it can't run and throw same exception as .Net Framework 2 , it meanse the CLR can see the dll's config file and use it !
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
What's your idea about this problem ? why .Net 4 can not run my .Net 2 DLL but it can run application (exe file) by same config properly ?
Sorry for my bad English .