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

  • Home
  • SEARCH
  • 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 7673187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:27:12+00:00 2026-05-31T16:27:12+00:00

I had set up the MvcBuildViews element to true so my MVC 3 project

  • 0

I had set up the MvcBuildViews element to true so my MVC 3 project would compile the views as well.

However, because of that, our build server is failing the builds. I had searched around for possible causes but my problem seems to be different from the common ones:

Error: _Layout.cshtml(xx): The name "Element" does not exist in the current context.

In this case Element is a reference we’re making to a Helper view, calling one of its methods.

Any idea what the problem may be?

(by the way, the build server is TFS2010)

  • 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-05-31T16:27:13+00:00Added an answer on May 31, 2026 at 4:27 pm

    I have found the issue underlying my problem. I’m updating here so that everyone can learn from my situation.

    The TFS build server kept failing so for the sake of moving on with the project, I just edited the MVC project so it wouldn’t compile the views on the server, but just on our dev machines. In order to do that, I changed from

      <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    

    to

      <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true' AND '$(BuildingInsideVisualStudio)'=='true'">
    

    When we took this all and deployed the builds to an actual environment, I found that the very same error popped out on our deployed environment. I went and took a look into the deployment package, only to find that my helper view Element.cshtml was not in the App_Code folder, where it was supposed to be.

    I opened the project file up again and searched for the reference to that file. I found that in that specific reference, the setting was

    <None Include="App_Code\Element.cshtml" />
    

    instead of

    <Content Include="App_Code\Element.cshtml" />
    

    I just changed the way the reference was made (dunno how it got that way) and everything worked like a charm.

    Moral of the story: Pay attention to what the error says.

    Now I’m curious about why wouldn’t it fail on our dev machines. Probably because the build server has a different output folder and so it wouldn’t find the .cshtml in the output? Maybe that’s something for some other question…

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

Sidebar

Related Questions

Due to some rather bizarre architectural considerations I've had to set up something that
If I had a java application that needed specific environment variables to be set,
I had set breakpoint in source code but it will give me warning that
I had set up a system that had a Java program running on a
I had set up my thread pool like this: ThreadPool.SetMaxThreads(10000, 10000); ThreadPool.SetMinThreads(20, 20); However,
So I have several datagridviews that we had set to FullRowSelect . The users
I've been developing a project on my local machine and had set up a
I had set up a bunch of NUnit unit tests using the Test connection
I had a problem with set not working in a batch file; it took
If you had two snippets: (global-set-key \C-d delete-char) and (define-key global-map \C-d delete-char) Is

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.