功能'插入串“是不是在C#5。请用语言版本6或更高版本。 [英] Feature 'interpolated strings' is not available in C# 5. Please use language version 6 or greater.

查看:1218
本文介绍了功能'插入串“是不是在C#5。请用语言版本6或更高版本。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我把剃刀查看以下行不能编译。

The following line does not compile when I put in a Razor View.

var extPropLookupNameCompania = $"extension_{SettingsHelper.ClientId.Replace("-", "")}_{"Compania"}";

然而,在控制器的同一行工作完全正常。

However in the controller the same line works perfectly fine.

为什么我不能在剃刀观点用户字符串插值?或者也许我需要配置什么?

Why I cant user string interpolation on the razor views? or Maybe I need to configure something?

推荐答案

如果您遇到在.NET框架4.5.1项目这个错误,升级到4.5.2解决了这个问题。

If you are experiencing this error in a .NET Framework 4.5.1 project, upgrading to 4.5.2 solves the problem.

这篇关于功能'插入串“是不是在C#5。请用语言版本6或更高版本。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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