RazorPages with filenames that include a hyphen cause IntelliSense to break

Deadly 提交于 2019-12-11 14:38:49

问题


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:

"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"

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

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

Does anyone know how to resolve this?


回答1:


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

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



来源:https://stackoverflow.com/questions/46854860/razorpages-with-filenames-that-include-a-hyphen-cause-intellisense-to-break

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!