簡體   English   中英

如何安裝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

鏈接將我轉發給Github上Roslyn項目 它似乎沒有提供任何二進制版本。

奇怪的是,谷歌搜索C# 6.0 compiler引發了幾個關於如何向Visual Studio 2013添加C#6.0支持的討論(大致或多或少你不能做到的共識),以及無數文章介紹(無可否認的精彩)新功能C#6.0,但沒有提示如何獲得C#6.0的編譯器。

那么: 我如何獲得MS C#6.0編譯器,如果需要,還可以獲得必要的構建工具,例如當前版本的MSBuild?

請注意,我通常不安裝Visual Studio,因為SharpDevelop似乎比我的目的更優越,所以當我已經擁有框架只是為了獲得最新的編譯器時,我擔心安裝幾千兆字節的數據。

來自GitHub上的Roslyn項目

要在不使用Visual Studio的情況下安裝最新版本,請運行以下nuget命令行之一:

 nuget install Microsoft.Net.Compilers # Install C# and VB compilers nuget install Microsoft.CodeAnalysis # Install Language APIs and Services 

要獲得每月發布一次的最新“預覽”刪除,請將-pre開關添加到nuget命令。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM