1

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?

sepp2k
  • 363,768
  • 54
  • 674
  • 675
Damina Townes
  • 11
  • 1
  • 2
  • Install Visual Studio Community 2017. Also make sure to update the language version in the project settings `Build` tab, click `Adavanced` button. – Olivier Jacot-Descombes Jul 04 '18 at 20:48
  • Possible duplicate of [C# 6.0 Features Not Working with Visual Studio 2015](https://stackoverflow.com/questions/27968963/c-sharp-6-0-features-not-working-with-visual-studio-2015) – Ogunleye Olawale Jul 04 '18 at 20:48
  • It is not an error, just a notification from the old compiler to remind you that it is, you know, old. Why you are not using the one provided by VS2015 is very unclear. Do create a project instead of trying to jockey it from the command line. – Hans Passant Jul 06 '18 at 22:02

1 Answers1

1

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.

Frank Boyne
  • 4,400
  • 23
  • 30