How To Enable C# 6.0 Language Preview in Visual Studio 14 CTP 3
This being the first post and all, I want to start by sharing the formula for getting access to C# 6.0 inside Visual Studio. I were a bit surprised, the Visual Studio 14 CTP 3 didn’t allowed access without any configuration. VS 14 CTP 3 includes a new version of the .NET framework called vNext, which could have been in the framework selector on the New Project wizard. Either I’m missing something, or Mads didn’t tell about this little magic trip to play with the new version.
To start writing some C# 6.0 wonders, download and install Visual Studio 14 CTP 3.
Create a new Console Application:
Right click the new project and Unload:
Right click the new project and edit the csproj file:
Locate the PropertyGroup looking like this:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Add a new element to that property group named LangVersion with the value Experimental:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>Experimental</LangVersion>
</PropertyGroup>
Reload the project and you are ready to rock and roll.
In the next post I take a look at Auto-Properties with Initializers.