Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use C# 7.1 in omnisharp? #961

Closed
NinoFloris opened this issue Sep 17, 2017 · 7 comments
Closed

How to use C# 7.1 in omnisharp? #961

NinoFloris opened this issue Sep 17, 2017 · 7 comments

Comments

@NinoFloris
Copy link

Things like default literal are already supported by compilers but omnisharp doesn't pick up the LangVersion csproj attribute and so roslyn gives errors for these features.
Unless I'm missing something and there is another way this should be fixed.

@willl
Copy link
Member

willl commented Sep 17, 2017

Hrm. I thought support was already added by #935? Which is part of release v1.23.1 and higher.

@NinoFloris Which version of omnisharp-roslyn have you got installed?

@NinoFloris
Copy link
Author

Running omnisharp vscode 1.12.1, 1.12.0 states in the changelog it now supports c# 7.1.

I cannot find how to enable that support however

@david-driscoll
Copy link
Member

use <LangVersion>latest</LangVersion> or <LangVersion>7.1</LangVersion> in your csproj. I'm actually not sure if latest does work off the top of my head.

@pnloyd
Copy link

pnloyd commented Sep 27, 2017

For the record latest does work.

@NinoFloris
Copy link
Author

If the property value was actually plumbed then yes, latest is a valid value and refers to the latest minor language version.

@vnextcoder
Copy link

Is there a LanguageVersion 7.3 support in Omnisharp/Rosyln with Visual Studio Code ?

Below VS code is fine with below 3 lines when I set LanguageVersion to 7.1, but VSCode doesn't recognise 7.3 and complains about tuple Comparison on 6th line ..

    int x=default;
    string y=default;
    bool z=default;
    var left = (1,5);
    var right = (1,5);
    Console.WriteLine(left==right);

The whole code works fine with "dotnet run" if I set Language Version using Visual Studio Community 15.7.3 but VSCode still keeps on complaining about Tuple Comparison .

Below is my CSPROJ

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <LangVersion>7.3</LangVersion>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <LangVersion>7.3</LangVersion>
  </PropertyGroup>
  <PropertyGroup>
  <LangVersion>7.3</LangVersion>
  </PropertyGroup>

  
</Project>

@DustinCampbell
Copy link
Contributor

Yes. However, this was just added and isn't in an official OmniSharp build yet. If you want to use C# 7.3 in VS Code you can set the following option in your VS Code settings:

{
  "omnisharp.path": "latest"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants