Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change C# language version to 7.2 in vs-code on Linux

I read that .NET Core 2.0 SDK support C# 7.2 by default but the features of C# 7.1 and 7.2 are disabled and we have to enable them. I install both SDK and C# extension for vs-code, but when I compile my code I got this error:

Program.cs(118,2): error CS1513: } expected [/home/smn/Desktop/myTest.csproj]

The build failed. Please fix the build errors and run again.

I also add these line to my .csproj file:

<PropertyGroup"> <LangVersion>7.2</LangVersion> </PropertyGroup>

try this too:

`<PropertyGroup">
<LangVersion>latest</LangVersion>
</PropertyGroup>`

and also try this too:

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

What should I do?!

like image 600
Ashkan Rahmani Avatar asked Mar 07 '18 18:03

Ashkan Rahmani


People also ask

What are examples of petition?

We presented a petition to the legislature to change the law. She filed a petition for divorce. We ask you to hear our petition. Verb The organization petitioned the government to investigate the issue.

What can Change.org do?

On Change.org, people everywhere are empowered to start campaigns, mobilize supporters, and work with Decision Makers to drive solutions. Learn the best ways to gain support for your cause and make change! We'll take you through the step by step process from starting your petition to declaring victory.

Who is Change.org funded by?

We are excited to announce that through the generosity of donations of equity from more than 50 of our investors, led by Reid Hoffman and including Bill Gates, Sir Richard Branson, Ray Dalio, Evan Williams, Jerry Yang, Sam Altman, and Arianna Huffington, Change.org is transitioning to 100% nonprofit ownership by the ...


1 Answers

If you have not been able to solve this yet, you should try to remove the erroneous quote (") in the PropertyGroup tag, which appears in all the examples you gave.

<PropertyGroup">

This works for me:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <LangVersion>7.2</LangVersion>
  </PropertyGroup>
</Project>
like image 110
Hilmar Nooitgedagt Avatar answered Oct 03 '22 12:10

Hilmar Nooitgedagt