Enabling C# 6.0 in Visual Studio 2013
A developer encountered compatibility issues when trying to use new C# 6.0 features (like auto property initializers) in Visual Studio 2013. Visual Studio 2013 doesn't inherently support C# 6.0, so here's how to add that support:
The solution is to install the necessary compilers via NuGet packages. This allows using C# 6.0 code without upgrading to Visual Studio 2015 or modifying your build server.
Follow these steps:
<code>Install-Package Microsoft.Net.Compilers</code>
After installation, you can write and build C# 6.0 code. However, Visual Studio 2013 might still show errors because it doesn't natively understand the new syntax. If you use ReSharper, you can enable C# 6.0 support project-by-project using the option "Enable C# 6.0 support for this project."
For full C# 6.0 support in MVC Razor views, install this additional package:
<code>Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform</code>
For the best experience and complete C# 6.0 functionality, consider upgrading to Visual Studio 2015.
The above is the detailed content of How Can I Use C# 6.0 Features in Visual Studio 2013?. For more information, please follow other related articles on the PHP Chinese website!