Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8540699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:39:38+00:00 2026-06-11T11:39:38+00:00

I have an existing razor 1 / mvc 3 view, with a few nested

  • 0

I have an existing razor 1 / mvc 3 view, with a few nested if – very simple, but after upgrading to razor 2 / mvc 4 it is complaining at runtime and compile (BuildViews) about } expected. It used to work fine.

  • I’ve checked all the elements are well-formed / closed
  • I’ve checked that all the { / } are balanced – this isn’t the end-of-file issue

What can be wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:39:40+00:00Added an answer on June 11, 2026 at 11:39 am

    A number of legacy razor oddities were fixed in the razor 2 / mvc 4 upgrade; one interesting gotcha is that in razor 1, the following is legal (in a code region):

    string foo = @Some.Complex.Expression;
    

    Note that the @ there is superfluous and incorrect, but that razor 1 does not complain. However, razor 2 is more fussy and gets confused, reporting the } expected error. This line should be replaced with:

    string foo = Some.Complex.Expression;
    

    This is a bit subtle, because the error that occurs has nothing to do with braces ({/}), and can be some lines away from the reported line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to MVC Razor. I have this view: @model SuburbanCustPortal.Models.CustomerModel @{ ViewBag.Title =
I have existing ASP.NET MVC View pages and View user controls which I currently
I have an existing site running BlogEngine.NET 1.5 and will be upgrading it to
I have existing websites with PHP/MySQL framework. They are very busy and chat, events,
I am new to MongoDb but have an existing application which would benefit heavily
I have existing project in Visual Studio 2010, ASP.NET MVC 3 with existing database
We have an existing MVC application that we're building using TeamCity and things were
I have built an ASP.NET MVC 3 web application (with exlusively Razor/cshtml pages) that
How do I enable razor syntax (??) for my MVC project (New, not existing).
I have an existing SqlConnection conn; in some controller (using ASP.NET MVC3 + Razor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.