将 RazorPages 与包含连字符的文件名一起使用时,它会导致 Visual Studio 的工具在有效代码上显示红色波浪线。
以下是我看到的一些常见错误:
"The name ViewData does not exist in the current context"
"The name TempData does not exist in the current context"
"The name Model does not exist in the current context"
例如,我的 RazorPage 调用Contact-Us.cshtml
(带有连字符)会出错
然而,我的页面ContactUs.cshtml
(没有连字符)会很好。
有谁知道如何解决这个问题?