[Mono-dev] Avoiding references to ExtensionAttribute so a program is compatible with MS.NET 2.0
Marek Safar
marek.safar at seznam.cz
Sun Nov 16 06:34:51 EST 2008
Hello Avery,
>
> I'm attempting to compile a C# program that uses extension methods
> using mono, and have it run under both mono and MS.NET <http://MS.NET>.
>
> This works fine (gmcs 1.9.1.0 <http://1.9.1.0>) when the target
> Windows system is running MS.NET <http://MS.NET> 3.5, but not when
> running MS.NET <http://MS.NET> 2.0. The problem appears to be the one
> described here:
>
>
> http://ironpython-urls.blogspot.com/2008/10/ironpython-2-and-fifth-assembly.html
>
> http://www.iamnotmyself.com/2008/09/22/UsingExtensionMethodsInNETFramework20.aspx
>
> If I understand correctly, creating an extension method results in
> your code referring to an attribute that is only in System.Core
> v3.5.0.0 or higher. However, this attribute doesn't actually do anything.
>
> It appears that the solution the IronPython guys claim to have used
> won't work with Mono, which seems to be pickier about allowing you to
> link when there are duplicated attribute names. However, since we
> have the source code to mono, maybe there's an even easier solution:
> just add an option to gmcs to deliberately leave out that attribute on
> extension methods. Would that work?
You will have to use newer Mono (SVN HEAD, or 2.2) and -noconfig
compiler option to disable System.Core assembly auto-reference.
Marek
More information about the Mono-devel-list
mailing list