在针对特定CSC.EXE版本frawework [英] targeting specific frawework version in csc.exe

查看:176
本文介绍了在针对特定CSC.EXE版本frawework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何指定通过命令行调用的CSC.EXE C#编译器(例如,不.csproj的文件,而不是去直通MSBuild引擎)的目标框架的版本?

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

例如,使用C#3.0编译器CSC.EXE,你怎么编译IL针对.NET Framework 2.0的?

e.g, using the C# 3.0 csc.exe compiler, how do you compile to IL targeting the 2.0 .net framework?

推荐答案

在C#编译器3的具体情况下,是没有问题的,只要你不使用,不能在.NET 2.0的组件或类型 - 白细胞介素是相同的(而不是目标1.1,例如)

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

除此之外,您可以使用/ noconfig包括/ nostdlib然后明确地引用了.NET 2.0组件(在C:\Windows\\ \\Microsoft.NET\Framework\v2.0.50727例如)。它看起来像/ lib目录命令行选项可以通过让你指定的目录中查找引用使这稍微容易一些,但我还没有尝试过我自己。

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.

这篇关于在针对特定CSC.EXE版本frawework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆