http://www.codethinked.com/post/2008/02/Using-Extension-Methods-in-net-20.aspx
This is a common trick that unfortunately has tricked into open source libraries. Don’t do it. It’s bad because this trick will generate warnings in C# ASP.Net web application projects and will fail completely on Visual Basic Web Application Project and Website project.
I just filed this to yet another open source library author.
---------------------------------------------------------------------
1. Create a new ASP.Net Web Application Project on Visual Studio 2008 on C#
2. Add OpenRasta.dll and OpenRasta.DI.Windsor.dll
3. It generates this warning
warning CS1685: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll'
If it is an ASP.Net 3.5 Website Project using C#, it generates
(0,0): warning CS1685: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll'
If you add this into a ASP.Net 3.5 Website Project using Visual Basic, it completely fails
InternalXmlHelper.vb(9,0): error BC30560: 'ExtensionAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'.
InternalXmlHelper.vb(24,0): error BC30560: 'ExtensionAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'.
InternalXmlHelper.vb(39,0): error BC30560: 'ExtensionAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'.
I know that this is a trick to enable extension method to run .Net 2.0 but I don't think it's worth it because it cause so much trouble with .Net 3.5 and beyond projects. Check out the trouble that IronPython team got into because of this http://devhawk.net/default,date,2008-10-21.aspx
------------------------------------------------------------------