targeting specific frawework version in csc.exe

前端 未结 1 577
孤城傲影
孤城傲影 2021-01-17 10:38

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)?

相关标签:
1条回答
  • 2021-01-17 11:23

    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.

    0 讨论(0)
提交回复
热议问题