Home > Backend Development > C++ > Why Doesn't Visual Studio 2013 Recognize My C# 6.0 Syntax?

Why Doesn't Visual Studio 2013 Recognize My C# 6.0 Syntax?

Mary-Kate Olsen
Release: 2025-01-18 00:28:08
Original
724 people have browsed it

Why Doesn't Visual Studio 2013 Recognize My C# 6.0 Syntax?

Resolving C# 6.0 Syntax Issues in Visual Studio 2013

The Problem:

Visual Studio 2013 fails to recognize C# 6.0 features like auto-property initializers.

Why This Happens:

Visual Studio 2013 lacks built-in support for C# 6.0. A compatible compiler is necessary.

The Solution: Using NuGet Packages

To enable C# 6.0 compilation and (partial) syntax highlighting, install the necessary NuGet packages:

  1. Access the NuGet Package Manager Console (Tools > NuGet Package Manager > Package Manager Console).
  2. Execute this command:
<code>Install-Package Microsoft.Net.Compilers</code>
Copy after login

This package allows building projects with C# 6.0 syntax.

Important Considerations:

  • While your project will build, Visual Studio 2013's code editor might still display errors.
  • For MVC Razor views supporting C# 6.0, install:
<code>Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform</code>
Copy after login

Alternative (Partial Support): Resharper

If you use Resharper, it may offer project-specific C# 6.0 support within its settings (.DotSettings).

Complete Solution: Upgrade Visual Studio

For full IntelliSense, code validation, and a seamless C# 6.0 experience, upgrade to Visual Studio 2015 or a later version.

The above is the detailed content of Why Doesn't Visual Studio 2013 Recognize My C# 6.0 Syntax?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template