4

I was trying to use the Dispose method of the XmlReader but it seemed it wasn't available. After looking around on the internet, I found out that in .Net 2.0 the IDisposable.Dispose method was implemented explicitly, but that this was "corrected" in .Net 4.0. Indeed, when I checked the method with .Net Reflector it was exposed publicly.

But although my project used .Net 4.0 as target framework, I still could not call the Dispose method without explicit casting the XmlReader to IDisposable.

Then I noticed that .Net Reflector decompiled C:\Windows\Microsoft.net\Framework\v4.0.30319\System.Xml.dll while my project used C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll as reference. I decompiled the latter and indeed, the Dispose method is still implemented explicitly in that one.

Why are there 2 different versions of the same dll for the same version of the framework ?

Can my Visual Studio 2010 be configured to use C:\Windows\Microsoft.net\Framework\v4.0.30319\ instead of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 when referencing the framework ?

P.S. I did not yet install the .Net 4.5 framework.

Community
  • 1
  • 1
Marc
  • 983
  • 2
  • 12
  • 28

0 Answers0