如何安装 MS C# 6.0 编译器?
How to install the MS C# 6.0 compiler?
我正在尝试编译某人在使用 C# 6.0 功能时创建的 C# 项目。
在以前的 .NET 版本中,当前的 C# 编译器会自动安装并准备好与 .NET Framework 一起 运行。显然,情况已不再如此。我的机器上目前有 .NET 4.6.1,但是调用 csc
告诉我:
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
link forwards me to the Roslyn project on Github。它似乎不提供任何二进制版本。
奇怪的是,谷歌搜索 C# 6.0 compiler
会引发一些关于 how to add C# 6.0 support to Visual Studio 2013 的讨论(共识或多或少是你做不到的),还有无数文章介绍了(不可否认的精彩) C# 6.0 的新功能,但没有提示如何获取 C# 6.0 的编译器。
那么:我如何获得 MS C# 6.0 编译器,如果需要,还需要必要的构建工具,例如当前版本的 MSBuild?
请注意,我通常不会安装 Visual Studio,因为 SharpDevelop 似乎更适合我的目的,所以当我已经有了框架时,我对安装几千兆字节的数据持谨慎态度获取最新的编译器。
来自the Roslyn project on GitHub:
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
To get the latest "preview" drop, published about once per month, add the -pre
switch to the nuget commands.
我正在尝试编译某人在使用 C# 6.0 功能时创建的 C# 项目。
在以前的 .NET 版本中,当前的 C# 编译器会自动安装并准备好与 .NET Framework 一起 运行。显然,情况已不再如此。我的机器上目前有 .NET 4.6.1,但是调用 csc
告诉我:
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
link forwards me to the Roslyn project on Github。它似乎不提供任何二进制版本。
奇怪的是,谷歌搜索 C# 6.0 compiler
会引发一些关于 how to add C# 6.0 support to Visual Studio 2013 的讨论(共识或多或少是你做不到的),还有无数文章介绍了(不可否认的精彩) C# 6.0 的新功能,但没有提示如何获取 C# 6.0 的编译器。
那么:我如何获得 MS C# 6.0 编译器,如果需要,还需要必要的构建工具,例如当前版本的 MSBuild?
请注意,我通常不会安装 Visual Studio,因为 SharpDevelop 似乎更适合我的目的,所以当我已经有了框架时,我对安装几千兆字节的数据持谨慎态度获取最新的编译器。
来自the Roslyn project on GitHub:
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
To get the latest "preview" drop, published about once per month, add the
-pre
switch to the nuget commands.