Difference between C# compiler version and language version
Difference between C# compiler version and language version
As nobody gives a good enough answer, I will have a try now.
First, C# has its version history published by Microsoft now (coming from MVP posts obviously),
https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history
So you can easily see what new features are added for each new releases.
Second, we will talk about the compiler releases, which initially were part of .NET Framework.
Below I list a few milestones (might not be 100% correct, and some versions might be skipped),
csc.exe1.0 (?) for .NET Framework 1.0 (implements C# 1.0).csc.exe2.0 (Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.8745) for .NET Framework 2.0 (implements C# 2.0, as well as 1.0 for compatibility).csc.exe3.5 (Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.8763) for .NET Framework 3.5 (implements C# 3.0, and older versions).csc.exe4.0 (?) for .NET Framework 4.0 (implements C# 4.0, and older).csc.exe4.x (like Microsoft (R) Visual C# Compiler version 4.7.2053.0) for .NET Framework 4.5 and above (implements C# 5.0, and older). Note that the version numbers vary a lot (from 4.x to 12.x) based on the .NET Framework on your machine (4.5.0 to 4.7.1).
Then Microsoft made the old csc.exe obsolete (as they were native executable), and shipped Roslyn based compiler instead (though still csc.exe). In the meantime, C# compiler is no longer part of .NET Framework, but part of VS.
It was the same time, that C# compiler, language version, and .NET Framework are fully decoupled, so that you can easily use multi-targeting.
- Roslyn
csc.exe1.x (?) implements C# 6.0 and older. Shipped with VS2015. - Roslyn
csc.exe2.x (like Microsoft (R) Visual C# Compiler version 2.4.0.62122 (ab56a4a6)) implements C# 7.x and older. Shipped with VS2017.
Ok, enough background. Back to your questions.
Q1: How to find out what C# version (not the compiler one, but the language one) uses VS to build my concrete project?
Answer: You can easily see from project settings that what language version is used.

If you don't choose an explicit version, it can automatically use the latest version supported by the csc.exe compiling the project.
Note that @Servy commented under @DaniloCataldo's answer about the langversion switch with more details. That switch has its design goals and limitation. So for example even if you force Roslyn 2.x compiler to compile your project based on C# 4.0, the compiled result would be different from what C# 4.0 compiler does.
Q2: Is there a strict, clear and transparent link between the C# compiler and language versions?
Answer: Please refer to the background I described above, I think that already answered this part. There is a strict, clear and transparent link.
Q3: Can I indicate to Visual Studio (in case of migration issues from one Studio version to another) to use different compiler version for my concrete solution?
Answer: Duplicate to Q1.
Difference between C# compiler version and language version的更多相关文章
- swift 第三方库迁移错误解决“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choo
先看看错误提示 这里Alamofire库报错,原因打开工程会Xcode会提示你覆盖到最新的3.0版本.但是仍然有些框架会出现一些问题 解决办法: 选择Pods - ReactiveCocoa - Sw ...
- “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift
使用cocopod导入第三方swift包后,编译报以下错误: The "Swift Language Version" (SWIFT_VERSION) build setting ...
- What is the difference between apache tomcat deployer and core version? - Stack Overflow
java - What is the difference between apache tomcat deployer and core version? - Stack Overflowhttps ...
- swift语言版本选择 - 解决XCode报错:The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported valu
转发链接:https://blog.csdn.net/nathan1987_/article/details/79757368 The “Swift Language Version” (SWIFT_ ...
- 解决linux下javac -version和java -version版本显示不一致
解决linux下javac -version和java -version版本显示不一致 [javascript] view plaincopy [root@localhost usr]# $JAVA_ ...
- 解决maven web项目Cannot detect Web Project version. Please specify version of Web Project through...的错误
前面已经创建maven web工程,但是问题来了,创建maven web工程之后会出现如下的错误,在pom.xml文件头部 有以下的错误 Description Resource Path Locat ...
- 解决Maven web 项目 Cannot detect Web Project version. Please specify version of Web Project through ... 的错误
创建maven项目的时候,maven文件头报错: Cannot detect Web Project version. Please specify version of Web Project th ...
- nginx的Mainline version、Stable version、Legacy version的版本区别
nginx的Mainline version.Stable version.Legacy version的版本区别 创建时间:2014-01-16 10:30:37最后修改:2014-09-23 20 ...
- /usr/local/lib/ruby/gems/2.4.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version`
问题及分析 今天做项目的时候,执行pod update报了如下错误信息: /usr/local/lib/ruby/gems/2.4.0/gems/cocoapods-1.5.3/lib/cocoapo ...
随机推荐
- sql server常用函数总结
1. 日期函数相关 日期格式格式化函数:),UpdateTime,) --第3个参数为是要转换成的日期的格式,不同的数字代表不同的格式: 日期加减函数: ,UpdateTime) --第一个参数是刻度 ...
- 使用百度echarts仿雪球分时图(二)
上一章简单的介绍了一下分时图的构成,其实就是折线图跟柱状图的组成.本来这章打算是把分时图做完,然后再写一章来进行美化和总结,但是仔细观察了一下,发现其实东西还是有点多的.分时图的图表做完后,还要去美化 ...
- requests模块高级操作之cookie
一.cookie 存储在客户端的键值对,可以让服务端记录客户端相关状态. 如何处理cookie? 手动处理: 将抓包工具中的请求头信息中的cookie键值拷贝到header中 自动处理:session ...
- 【Java并发】线程安全和内存模型
一.概述 1.1 什么是线程安全? 1.2 案例 1.3 线程安全解决办法: 二.synchronized 2.1 概述 2.2 同步代码块 2.3 同步方法 2.4 静态同步函数 2.5 总结 三. ...
- PAT Basic 1083 是否存在相等的差 (20 分)
给定 N 张卡片,正面分别写上 1.2.…….N,然后全部翻面,洗牌,在背面分别写上 1.2.…….N.将每张牌的正反两面数字相减(大减小),得到 N 个非负差值,其中是否存在相等的差? 输入格式: ...
- Codeforces 1187 G - Gang Up
G - Gang Up 思路: 每个点按时间拆点建边,然后跑最小费用流 一次走的人不能太多,假设每次走的人为k (k*k-(k-1)*(k-1))*d <= c+d k <= 24 代码: ...
- 通过轻量级终端工具Tera Term远程向linux操作系统上传war文件
通过轻量级终端工具Tera Term远程向linux操作系统上传war文件 1.打开Tera Term终端工具,并输入正确的远程机器的IP地址以及端口号: 2.输入正确的用户名和密码进入到linux操 ...
- C# ado.net 操作(一)
简单的增删改查 class Program { private static string constr = "server=.;database=northwnd;integrated s ...
- MSMQ使用
Message Message是MSMQ的数据存储单元,我们的用户数据一般也被填充在Message的body当中,因此很重要,让我们来看一看其在.net中的体现,如图: 在图上我们可以看见,Messa ...
- HGOI 20191108 题解
Problem A 新婚快乐 一条路,被$n$个红绿灯划分成$n+1$段,从前到后一次给出每一段的长度$l_i$,每走$1$的长度需要$1$分钟. 一开始所有红绿灯都是绿色的,$g$分钟后所有红绿灯变 ...