How do you specify a target framework version for the csc.exe c# compiler via command-line invocation (e.g., no .csproj file and not going thru the MSBUILD engine)?
e.g, using the C# 3.0 csc.exe compiler, how do you compile to IL targeting the 2.0 .net framework?
In the specific case of the C# 3 compiler, there isn't a problem so long as you don't use any assemblies or types which aren't in .NET 2.0 - the IL is the same (as opposed to targeting 1.1, for instance).
In addition to this, you can use /noconfig /nostdlib and then explicitly reference the .NET 2.0 assemblies (in c:\Windows\Microsoft.NET\Framework\v2.0.50727 for example). It looks like the /lib command line option can make this slightly easier by letting you specify a directory to look in for references, but I haven't tried that myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With