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

查看:20
本文介绍了文件名包含连字符的 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"
名称模型在当前上下文中不存在"

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

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.

有人知道如何解决这个问题吗?

Does anyone know how to resolve this?

推荐答案

我在 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

This is a known bug and will be resolved with the release of Visual Studio 15.5

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

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