[Mono-list] using gmcs and C# 3.0 features without requiring System.Core.dll

Raja R Harinath harinath at hurrynot.org
Fri Sep 5 03:20:58 EDT 2008


Hi,

"Dan Shryock" <dan.shryock at gmail.com> writes:

> I'm working on a project which is using some C# 3.0 features, but I am
> hoping to target the .NET 2.0 runtime on windows.
>
>>From what I have read[1] I should be able to add my own
> implementations of the few types I need.
>
> My real question is how do I stop gmcs from adding references to
> System.Core.dll, and instead use my implementations of those types?

The correct answer is '-noconfig' :-)

However, it doesn't always work, as seen in this stanza in mcs/driver.cs:

	if (!load_default_config){
		//
		// Yet another SRE related problem, we have to always load System.Core
		// even with -noconfig, otherwise the check for ExtensionAttribute in
		// loaded assemblies won't work
		//
		if (need_system_core && references.Count != 0 && Driver.OutputFile != "System.Core.dll")
			soft_references.Add ("System.Core");
		
		return;
	}

I guess we could do the ExtensionAttribute check on an assembly only if
it references System.Core, and remove this stanza.  Patches welcome, I
guess ;-)

- Hari



More information about the Mono-list mailing list