gpt4 book ai didi

c# - 如何安装 MS C# 6.0 编译器?

转载 作者:太空狗 更新时间:2023-10-29 17:47:44 24 4
gpt4 key购买 nike

我正在尝试编译某人在使用 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将我转发给 Roslyn project on Github .它似乎不提供任何二进制版本。

奇怪的是,谷歌搜索C# 6.0 编译器 引发了关于 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# - 如何安装 MS C# 6.0 编译器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39089426/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com