In a project which target framework is 3.5 the following line compiles with MsBuild 4.0:
aEnumerable.Select(aMethod);
But MsBuild 3.5 requires me to write:
aEnumerable.Select(item => aMethod(item));
Will both binaries will run a machine without .NET Framework 4.0, but with .NET 3.5?
PS: While i showed an example using "method overload inference" the same happens with other "4.0" features (eg. "named parameters").
another title for this question could be: What C# 4.0/Visual Studio 2010 features are .NET 3.5 compatible?
You are confusing Msbuild and the .NET framework.
Msbuild is just a tool to build .NET projects. Version 4.0 is required to build .NET 4 projects, but it can also do .NET 1.1, 2.0, 3.0, 3.5, 3.5 SP1. Its just like using Word 2010 to open a Word 2003 file. 2010 will open both, but 2003 will crash if you give it a 2010 file
Your code examples are showing differenecs added to the framework in version 4.0. You cannot execute .NET 4 code on a machine that doesn't haven't the .NET 4.0 framework installed. Doesn't matter what builds it, the runtime will not be able to understand the CLR and it won't run
As for msBuild itself: MsBuild 4.0 is a new version, largely updated to support .NET 4, but also with its own features. Consult the release notes for msbuild4 if you need those details.
That said, MsBuild 4 is fully capable of producing .NET 3.5 output so long as the targetFramework is properly configured. (We moved all our builds to MsBuild 4.0 long before we upgraded all projects to the .NET 4 framework)