Home > Software engineering >  Single-statement control-flow statements in Razor documents statements cannot contain markup error?
Single-statement control-flow statements in Razor documents statements cannot contain markup error?

Time:04-06

Getting the following error:

Single-statement control-flow statements in Razor documents statements cannot contain markup. Markup should be enclosed in "{" and "}".

enter image description here

I am building ASP.NET CORE 5 project and I get this error. I don't understand what error is this. Is there anyone who can help?

CodePudding user response:

I try to search you the most persuasive blog or article for you.

Why my previous comment suggested deleting some folders and re-running the IDE is because we had this problem before too. I think what Rick Strahl's blog describes is our problem in this post. When we only compile, we should not encounter the above error.

Fixing Visual Studio Intellisense Errors

Of course, when you reopen it with VS2022, the problem will disappear.

  • Related