VS Code CSC : error CS1617: Invalid option '7.3' for /langversion

Spydernaz picture Spydernaz · May 10, 2018 · Viewed 27.7k times · Source

I downloaded VS 2017 15.7, .NET Core 2.1.2 and Blazor to try it out. It wasn't working in VS 2017 properly and thought I would try through the dotnet cli and VS Code. Instead I was met with the following error:

CSC : error CS1617: Invalid option '7.3' for /langversion.

In VS, it will run the application show "Loading..." and then nothing. Not sure if the two issues are related

dotnet --info returns the following:

.NET Command Line Tools (2.1.300-preview1-008174)

Product Information:
 Version:            2.1.300-preview1-008174
Commit SHA-1 hash:  b8df89a54f

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17666
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300-preview1-008174\

Microsoft .NET Core Shared Framework Host

  Version  : 2.1.0-preview1-26216-03
  Build    : f2c3216183d20416568a4bbf5bb7d153e826f153

Answer

Adam picture Adam · Jun 24, 2020

Just had this and a Clean, Rebuild fixed the issue for me.