简体   繁体   English

什么是用于指定.net框架版本的C#编译器选项

[英]what is the C# compiler option for specifying the version of .net framework

I have look completely in this two msdn article C# Compiler Options Listed Alphabetically and C# Compiler Options Listed by Category for compiler option for specifying the target framework version which can be used in command line building. 我完整地看了这两篇msdn文章按字母顺序列出的C#编译器选项按类别列出的C#编译器选项,用于指定可在命令行构建中使用的目标框架版本的编译器选项。 I got to know that we can specify the framework version in app.config with supportedRuntime element. 我知道我们可以使用supportedRuntime元素在app.config中指定框架版本。

Can we use this element( configuration > startup > supportedRuntime ) in web.config also(in case of asp.net application) ? 我们可以在web.config中使用这个元素( configuration > startup > supportedRuntime )(在asp.net应用程序的情况下)?

I have not needed to do it with only command line switch. 我只需要命令行开关就不需要这样做了。 I just asking this question only because of curious to know about it. 我只是因为好奇才知道这个问题而问这个问题。

The compiler doesn't care about what version of the framework , only the version of the runtime and the language . 编译器不关心框架的版本,只关注运行时的版本和语言

The cl.exe program just compiles and links whatever you throw at it, and it is up to you to add references to .NET 4.5-specific assemblies or not. cl.exe程序只是编译并链接你抛出的任何东西,你可以自行添加对.NET 4.5特定程序集的引用。 You can choose to reference older versions of external references by specifically asking for a version using a fully qualified assembly name. 您可以选择通过专门要求使用完全限定的程序集名称的版本来引用旧版本的外部引用。

The setting in Visual Studio is just a filter that shows/hides assemblies when you are adding references. Visual Studio中的设置只是一个过滤器,用于在添加引用时显示/隐藏程序集。

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

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