如何在 Visual Studio 2013 中启用 C# 6.0 功能? [英] How to enable C# 6.0 feature in Visual Studio 2013?

查看:41
本文介绍了如何在 Visual Studio 2013 中启用 C# 6.0 功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 C# 6.0 中引入的最新功能,并遵循了一个自动属性初始值设定项的示例,

I was going through the latest features introduced in C# 6.0 and just followed an example of auto property initializer,

class NewSample
{
    public Guid Id { get; } = Guid.NewGuid();
}

但我的 IDE 无法识别语法.

but my IDE did not recognize the syntax.

我想知道如何在 Visual Studio 2013 中启用 C# 6.0.我使用的目标框架是 4.5.1.

I am wondering how I could enable C# 6.0 in Visual Studio 2013. The Target framework I am using is 4.5.1.

推荐答案

已过时预发布软件的信息:

根据this,它只是安装并适用于 Visual Studio2013 年:

Information for obsoleted prerelease software:

According to this it's just a install and go for Visual Studio 2013:

事实上,安装此版本的 C# 6.0 编译器只需要安装 Visual Studio 2013 扩展,后者又会更新 MSBuild 目标文件.

In fact, installing the C# 6.0 compiler from this release involves little more than installing a Visual Studio 2013 extension, which in turn updates the MSBuild target files.

因此,只需从 https://github.com/dotnet/roslyn 获取文件,您就可以准备出发.

So just get the files from https://github.com/dotnet/roslyn and you are ready to go.

您必须知道它是在那里实施的规范的过时版本,因为它们不再更新 Visual Studio 2013 的包:

您还可以尝试安装在 Visual Studio 2013 之上的 April 的最终用户预览版.(注意:这个 VS 2013 预览已经过时,不再更新)

You can also try April's End User Preview, which installs on top of Visual Studio 2013. (note: this VS 2013 preview is quite out of date, and is no longer updated)

因此,如果您确实想使用最新版本,则必须下载Visual Studio 2015.

So if you do want to use the latest version, you have to download the Visual Studio 2015.

这篇关于如何在 Visual Studio 2013 中启用 C# 6.0 功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆