如何安装MS C#6.0编译器? [英] How to install the MS C# 6.0 compiler?
问题描述
我试图编译使用C#6.0功能创建的C#项目。
I am trying to compile a C# project that someone has created while using C# 6.0 features.
在以前的.NET版本中,当前的C#编译器是自动安装的,准备与.NET Framework一起运行。显然,情况已不再如此。我当前在计算机上安装了.NET 4.6.1,但是调用 csc
告诉我:
In previous .NET releases, the current C# compiler was automatically installed and ready to run along with the .NET Framework. Apparently, this is no longer the case. I currently have .NET 4.6.1 on my machine, but invoking csc
tells me:
Microsoft (R) Visual C# Compiler version 4.6.1055.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework, but only
supports language versions up to C# 5, which is no longer the latest version. Fo
r compilers that support newer versions of the C# programming language, see http
://go.microsoft.com/fwlink/?LinkID=533240
The link forwards me to the Roslyn project on Github. It does not seem to offer any binary releases.
奇怪的是,使用 C#6.0编译器
进行谷歌搜索会带来一些麻烦。 >如何添加C#6.0支持的讨论Visual Studio 2013 (人们或多或少会达成共识),无数文章介绍了C#6.0的(令人称奇的)新功能,但没有提示如何获取C#编译器6.0。
Curiously, googling for C# 6.0 compiler
brings up a couple of discussions on how to add C# 6.0 support to Visual Studio 2013 (with the consensus being more or less that you can't), and countless articles presenting the (admittedly wonderful) new features of C# 6.0, but not a hint on how to obtain a compiler for C# 6.0.
因此:我如何获得MS C#6.0编译器以及必要的构建工具(如当前版本的MSBuild)? strong>
So: How can I get the MS C# 6.0 compiler, and, if required, the necessary build tools such as current versions of MSBuild?
请注意,我通常没有安装Visual Studio,例如 SharpDevelop 似乎对我而言是优越的,因此,当我已经有了用于启动的框架时,我会警惕安装数GB的数据最新的编译器。
Note that I do not usually have Visual Studio installed, as SharpDevelop seems to be superior for my purposes, so I am wary of installing several gigabytes of data when I already have the framework just to get the up-to-date compiler.
推荐答案
来自 GitHub上的Roslyn项目:
最新版本(不带Visual Studio),请运行以下nuget命令行之一:
To install the latest release without Visual Studio, run one of the following nuget command lines:
nuget install Microsoft.Net.Compilers # Install C# and VB compilers
nuget install Microsoft.CodeAnalysis # Install Language APIs and Services
获取最新版本每月大约发布一次的 preview下拉菜单将 -pre
开关添加到nuget命令。
To get the latest "preview" drop, published about once per month, add the -pre
switch to the nuget commands.
这篇关于如何安装MS C#6.0编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!