我在新的 VS2017 中打开了我现有的 VS2015 解决方案.希望它能正常工作,但是,我在诸如 @model、@ViewBag、@ActionLink、@Url、@Partial、@Scripts、@Styles 以及 where 子句中的 lambda 表达式之类的词下看到了很多红线在页面模型上.
不确定有什么遗漏或错误.解决方案已构建,但在 cshtml 文件中显示错误.
任何帮助或指导都会有所帮助.
提前致谢.肯
解决方案我遇到了这个问题并且
MVC 4.0.0.0 -> 5.2.3.0
I opened my existing VS2015 solution in the new VS2017. Was hoping it would just work, however, I am seeing a lot of red lines under words like - @model, @ViewBag, @ActionLink, @Url, @Partial, @Scripts, @Styles, and under lambda expressions in the where clause on the model for the page.
Not sure what is missing or wrong. The solution builds, but shows errors in the cshtml files.
Anyone help or direction would be helpful.
Thanks in advance. Ken
解决方案I had this issue and stackoverflow/a/19696998/4484478 fixed it for me. My solution was created with VS2012. I started using VS2013 and VS2015 to work on this solution after RTM came out and the issue OP described occurred after I started using VS2017.
From the answer post:
Create a new project targeting same .NET framework and copy its Views/web.config file over top the one in your current project.
Note that the web.config here is the one inside the Views folder and not the main one. This is probably the simplest way to fix it. But if you have some other customization in this file you can try editing manually the version numbers for Razor and MVC. Mine changed from 2.0.0.0 -> 3.0.0.0 for Razor
And 4.0.0.0 -> 5.2.3.0 for MVC
更多推荐
Visual Studio 2017 cshtml 文件错误
发布评论