简体   繁体   English

在csc.exe中定位特定的frawework版本

[英]targeting specific frawework version in csc.exe

How do you specify a target framework version for the csc.exe c# compiler via command-line invocation (eg, no .csproj file and not going thru the MSBUILD engine)? 如何通过命令行调用为csc.exe c#编译器指定目标框架版本(例如,没有.csproj文件而不通过MSBUILD引擎)?

eg, using the C# 3.0 csc.exe compiler, how do you compile to IL targeting the 2.0 .net framework? 例如,使用C#3.0 csc.exe编译器,如何编译为针对2.0 .net框架的IL?

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). 在C#3编译器的特定情况下,只要您不使用任何不在.NET 2.0中的程序集或类型就没有问题 - IL是相同的(而不是针对1.1,因为实例)。

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). 除此之外,您可以使用/ noconfig / nostdlib,然后显式引用.NET 2.0程序集(例如,在c:\\ Windows \\ Microsoft.NET \\ Framework \\ v2.0.50727中)。 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. 看起来像/ lib命令行选项可以通过让你指定一个目录来查找引用来使这更容易,但我自己没有尝试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM