Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling C# 6 in ASP.VNext projects in Visual Studio CTP2

I have installed Visual Studio CTP2 and created a new ASP.Net Vext project. When I tried using C# 6.0 features, it was not working. I even tried the stpes in the following link.

No C# 6.0 in Visual Studio 2015 CTP?

But even after this I was not able to use C# 6 in VNext projects. Please help.

like image 263
Thanigainathan Avatar asked Aug 03 '14 15:08

Thanigainathan


2 Answers

Add this to your project.json:

"compilationOptions": { "languageVersion": "experimental" }

like image 95
davidfowl Avatar answered Sep 21 '22 16:09

davidfowl


You should not add the net451 object. Use this inside the project.json file:

{
    "compilationOptions": { "languageVersion": "experimental"},
    "dependencies": {
    },
    "commands": {
    }
}

I believe they also changed the default in the latest version of the engine. so the element is actually not needed anymore if you upgrade tje kvm to the lastest version.

see https://github.com/aspnet/KRuntime/pull/512

Upgrading can be done by running kvm upgrade at the command prompt.

see https://github.com/aspnet/Home/wiki/version-manager

HTH, Bart

like image 30
DesDesDes Avatar answered Sep 21 '22 16:09

DesDesDes