使用记事本之类的工具进行C#代码编写设置环境变量时易发生的错误
一般教程中path的位置如下,但是很容易出现问题(尤其是visualStudio存在重装且修改过安装位置的情况)。
如图可能发生的错误:This compiler is provided as part of the Microsoft ® .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240。点击这个链接后,其实我还是不太明白要干啥。
在网上查阅一些资料后,没有找到正确的解决方式。但是大部分的解答是要找到csc.exe文件,在错误的path下也是存在csc.exe文件的,但是我看了下此文件的日期,不是此次visualStudio安装的日期,结合网上的一些path,最终在D:\Microsoft Visual Studio\MSBuild\Current\Bin\Roslyn找到另一个csc.exe,为此次visualStudio安装后才存在的,于是更改路径。
至此错误解决。
我觉得如果在教程中的目录下找不到正确的csc.exe文件,一般可以考虑去visualStudio的安装目录下找找看MSBuild目录中是否存在,网上大家的路径各不一致,比如:C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe等等。