带有连字符的文件名的RazorPages导致IntelliSense中断 [英] RazorPages with filenames that include a hyphen cause IntelliSense to break

查看:129
本文介绍了带有连字符的文件名的RazorPages导致IntelliSense中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用带有连字符的文件名的RazorPages时,它将导致Visual Studio的工具在有效代码上显示红色的波浪线。

When using RazorPages with filenames that include a hyphen, it causes Visual Studio's tooling to show a red squiggly line on valid code.

这是一些常见的错误我看到了:

here are a few common errors I see:


名称ViewData在当前上下文中不存在

名称TempData在当前上下文中不存在

名称模型当前上下文中不存在

例如,我的RazorPage称为 Contact -Us.cshtml (带连字符)将出错

For example, my RazorPage called Contact-Us.cshtml (with the hyphen) will error

而我的页面 ContactUs.cshtml (不带连字符)就可以了。

Whereas, my page ContactUs.cshtml (without the hyphen) will be fine.

有人知道如何解决吗?

推荐答案

我在GitHub上发现了此问题。 https://github.com/aspnet/Mvc/issues/6296

I found the issue reported on GitHub. https://github.com/aspnet/Mvc/issues/6296


这是一个已知的错误,将在发布 Visual Studio 15.5

这篇关于带有连字符的文件名的RazorPages导致IntelliSense中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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