Damina Townes
Damina Townes

Reputation: 11

How to update C# Compiler to version 6-Visual Studio Community 2015

I have been trying to update my C# compiler after getting the below error when trying to compile a file:

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. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

I downloaded Roslyn as directed (not sure if it needed to go in a particular folder with the visual studio files) but didn't get any further with it.

I also found guidance to run the below command in visual studio :

Install-Package Microsoft.Net.Compilers

But this also generates errors when attempting, regardless of whether or not a solution is open.

I'm trying to get the compiler to update to version 6, I feel like this should be very simple but I haven't gotten anywhere with the advice I've researched. Any ideas?

Upvotes: 1

Views: 5072

Answers (1)

Frank Boyne
Frank Boyne

Reputation: 4570

If you are using Visual Studio 2015 Community Edition you should already have the C# 6 compilers since they shipped with Visual Studio 2015.

I just installed the RTM version of Visual Studio 2015 Community Edition on a clean system. The csc.exe compiler it installs (under C:\Program Files (x86)\MSBuild\14.0\Bin\ reports itself as Microsoft (R) Visual C# Compiler version 1.0.0.50618. The file's modified date is 6/21/2015.

The help section on the langversion switch reports /langversion: <string> Specify language version mode: ISO-1, ISO-2, 3, 4, 5, 6, or Default

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. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

The wording of this warning message suggests that you are using a version of the C# compiler shipped with the .NET Framework rather than one that was shipped with Visual Studio 2015.

Upvotes: 1

Related Questions