Views do not recognize @model, @Viewbag, @Viewdata

Asked

Viewed 663 times

5

I am using Mono 5.10.1 and Visual Studio Professional for Mac (Version 7.5.4 build 3)

Views do not recognize tags like @model, @Viewbag and @Viewdata, either in older projects that were originally created in Visual Studio 2017 Windows, or in a simple new project using . Net Framework 4.6.1

I put in GIT a standard project created, even in it the Views do not recognize the tags, but by downloading the project in a Visual Studio 2017 Windows the tags are recognized normally. GIT: https://github.com/DanielGregatto/TesteRazor

Has anyone been through this? I’ve been researching for a few days now.

  • It does not recognize in the editor or also shows error in execution?

  • Only in the editor, build works normally.

  • I don’t know if you’ve ever seen this: https://stackoverflow.com/questions/30311355/visual-studio-2015-not-syntax-highlighting-razor-nor-intellisense It’s the same problem?

  • @Williamjohnadamtrindade Yes, I have tried this solution. I have deleted all preferences and VS cache.

  • @Danielgregatto But it’s the same problem, I mean, the description of the problem is the same that you’re experiencing right now?

  • @Williamjohnadamtrindade Yes

  • I have had similar problem and I will just link here: https://answall.com/questions/141896/highlighting-n%C3%A3o-funciona-nas-views-Razor-mvc-5

Show 2 more comments

1 answer

0

This is because your project is not recognizing the Razor library.

Via Nuget, check which version of Razor is installed in your project. Then access the files Packages.config and Web.config and review the versions of this library. There may be more than one reference and be sure to check the file Web.config present also in the Views folder.

It is worth remembering that the file Packages.config cites the raw version of the package, which may be different from the version quoted in Web.config.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.