Reflection of an old version of System.dll

I have assembly activity that reflects one of our libraries to compare it with a domain definition. During reflection, when I try to flip Uri, it returns as RunTimePropertyInfo instead of Uri, and whenever I check any of the reflected properties, I get an exception message ...

"Could not load file or assembly 'System, Version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e, retargetable=yes" 

Build activity is compiled using System.dll version 4.0.0.0. I suspect this is a problem. Is there a way to reflect the type of the old version of System.dll.

So far, this has only failed with Uri. Any ideas?

+6
source share
2 answers

I think that there is a problem with the versions, if you use a different version of the dll that is used in the project, in this case such an error may occur.

here is one simple solution that worked for me in the past, it will work for you if there is the same problem. you can use the bindingRedirect tag in web.config, specifying the old and new versions of the problematic DLL. so this means that it will ignore the old version of the dll link and use the newer if it is found. And it will not generate an error.

here is the link. http://msdn.microsoft.com/en-us/library/eftw1fys%28v=vs.71%29.aspx

0
source

You need to use something like IKVM.Reflection,

http://weblog.ikvm.net/PermaLink.aspx?guid=d0dc2476-471b-45f3-96bf-a90bc2f5800b

Microsoft reflection is tied to the hosted .NET Framework, so you cannot download an earlier version of the core libraries as desired.

0
source

All Articles