在哪里将Razor页面语言版本配置为C#6? [英] Where to configure Razor page language version to C# 6?

查看:208
本文介绍了在哪里将Razor页面语言版本配置为C#6?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我尝试在ASP.NET MVC(5).cshtml视图中使用某些C#6新功能(内插字符串),但是在运行时出现错误消息,提示$.很明显,编译器处于C#5兼容模式下,或者更糟糕的是,它是C#5编译器.

Recently I've tried to use some C# 6 new feature (interpolated strings) in my ASP.NET MVC (5) .cshtml view, but when running got an error message complaining about the $. It is clear the compiler in C# 5 compatibility mode, or worst it is a C# 5 compiler.

在编辑器中弹出警告警告我(我不知道它是VS还是ReSharper)Feature 'Interpolated strings' is not available in C# 5. Please use language version 6 or greater.

When in editor a popup warning warns me (I do not know it is VS or ReSharper) Feature 'Interpolated strings' is not available in C# 5. Please use language version 6 or greater.

项目本身设置为C#6,我可以在构建时编译的代码(如控制器等)中使用C#6功能.

The project itself was set to C# 6, and I can use C# 6 features in my build time compiled code like controllers etc.

问:我应该在哪里设置页面编译器版本,当我将Web应用程序部署到Azure时,此C#6编译器是否可用?

Q: Where should I set page compiler version, and will this C# 6 compiler available when I deploy my web app to Azure there?

推荐答案

来自这仅在MVC6中有效.另外,也请通过对此链接的评论,从ASP.Net添加roslyn代码dom包.

This only works in MVC6. Alternatively, also from a comment on this link, you'll need to add the roslyn code dom package from ASP.Net.

<div>
    @($"Hello {this.Model.SomeProperty}")
</div>

就Azure而言,请参阅此链接. http://azure.microsoft.com/blog/2015/08/11/update-on-net-framework-4-6-and-azure/

As far as Azure is concerned, please see this link. http://azure.microsoft.com/blog/2015/08/11/update-on-net-framework-4-6-and-azure/

功能强大……工具,框架和Azure平台团队希望 确保我们提供给您的强大工具来帮助您实现梦想是 与我们认识到的责任相匹配,我们必须保持其运转 在云中.在使用Visual Studio和Azure SDK 2.7时 发行版中,Azure并未广泛支持Framework 4.6. 这在很大程度上是由于以下事实: 更多)负责持续发展和稳定 Azure平台.

With great power… The tooling, framework and Azure platform teams want to ensure the powerful tools we give you to help build your dream is matched by the responsibility we recognize we have to keep it running in the cloud. At the time of the Visual Studio and Azure SDK 2.7 releases, Framework 4.6 wasn’t supported broadly throughout Azure. This is due in large part to the fact that just as many teams (or more) are responsible for the ongoing development and stability of the Azure platform.

目前,我们已经更新了.NET Framework 4.6的可用性 适用于Azure App Service和一篇演示如何获取.NET的文章 Framework 4.6在您的Cloud Service角色中工作.

For now, we have an update on the availability of .NET Framework 4.6 for Azure App Service and an article demonstrating how to get .NET Framework 4.6 working in your Cloud Service roles.

Azure IaaS 对于使用Azure基础结构即服务的客户 (IaaS)服务,.NET Framework 4.6的安装是手动的.到 在Azure IaaS虚拟机上安装.NET Framework 4.6 过程就像使用远程登录虚拟机一样简单 桌面.一旦在计算机上,就可以将.NET Framework 4.6安装程序 下载并直接安装到虚拟机上.顾客 使用Azure自动化还可以选择自动化安装 使用PowerShell在Azure虚拟机上.

Azure IaaS For customers using Azure’s Infrastructure as a Service (IaaS) services, installation of .NET Framework 4.6 is manual. To install .NET Framework 4.6 on an Azure IaaS virtual machine, the process is as simple as logging into the virtual machine using Remote Desktop. Once on the machine, the .NET Framework 4.6 installer can be downloaded and installed directly onto the virtual machine. Customers using Azure Automation could also choose to automate the installation onto Azure virtual machines using PowerShell.

Azure应用服务 更新Azure App Service团队即将结束 .NET Framework 4.6的测试阶段,并计划 部署到环境中.目前,计划是推出 在2015年8月更新Azure应用服务.

Azure App Service Update The Azure App Service team is nearing the end of the testing phase for .NET Framework 4.6 and planning the deployment to the environments. Currently, the plan is to roll out the updates to Azure App Service during August 2015.

Azure云服务 Saurabh Bhatia在Azure中撰写了一篇文章 文档中心概述了如何在.NET Framework中安装.NET Framework. 云服务角色.内容最近已更新为包括 .NET Framework 4.6的注释.您可以找到更新的 在Azure文档中心的此处.

Azure Cloud Services Saurabh Bhatia authored an article in the Azure documentation center outlining how to install the .NET Framework in a Cloud Service Role. The content has been recently updated to include commentary specific to .NET Framework 4.6. You can find the updated article here on the Azure documentation center.

这篇关于在哪里将Razor页面语言版本配置为C#6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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