Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

c# - RazorPages with filenames that include a hyphen cause IntelliSense to break

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

no

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

yes

Does anyone know how to resolve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...