skip to Main Content

Visual Studio is giving me this error: "CS1617 C# Invalid option for /langversion. Use to list supported values" and I do not know how to fix it. I have looked around the internet and I cannot find the fix to it. I have tried many things and I do not know how to work on this, as I cannot build and test my .NET code without building it.

I tried some people with the same error on stackoverflow, and none of the solutions that people gave worked for me, if someone could give me a fix that would work that would be very appreciated. I use visual studio 2022 version 17.1.6

2

Answers


  1. You should either install the sdk of the framework version the project is using or replace it with an existing version.

    Login or Signup to reply.
  2. Microsoft documents the accepted values for langversion in Microsoft Learn.

    I am using the following in my .csproj project file:

    <PropertyGroup>
        <LangVersion>latest</LangVersion>
    </PropertyGroup>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search