Visual Studio 2017 cshtml 文件错误

编程入门 行业动态 更新时间:2024-10-19 11:37:55
本文介绍了Visual Studio 2017 cshtml 文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在新的 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 文件错误

本文发布于:2023-11-14 09:55:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586902.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   文件   Studio   Visual   cshtml

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!