gfullam gfullam - 1 year ago 168
C# Question

Visual Studio 2012 MVC build error: The type or namespace name 'Infrastructure' does not exist in the namespace 'System.Data.Entity'

Update: The assembly reference to System.Data.Entity is selected in the Reference Manager.

The Setup

I get an error when trying to run an out-of-the-box ASP.NET MVC 3 Web Application. I made no modifications.

I simply chose File > New Project > Visual C# > ASP.NET MVC 3 Web Application and left all the default settings intact.

Under Project Settings, I chose Internet Application for the template, Razor for the view engine, and checked Use HTML5 semantic markup.

I then immediately chose Build > Build Solution which fails and produces this error and five other warnings (shown in the screenshot).

The Error

Error 1 The type or namespace name 'Infrastructure' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)

C:\Users\johndoe\Documents\Visual Studio 2012\Projects\MvcApplication1\MvcApplication1\Global.asax.cs

Yes, I know...

...this question has been askedmany times — but the answers on those posts do not provide adequate information to solve my problem.

Please, be specific in your response, with step-by-step instructions, as I am new to Visual Studio and its MVC app development framework.

The Question

What would cause Visual Studio not to work right out-of-the-box? This is a fresh install. Is there an update that could have caused this issue or could fix this issue?

The Screenshot

Screenshot of Visual Studio Error List

System Information

Microsoft Visual Studio Ultimate 2012
Version 11.0.61030.00 Update 4

Microsoft .NET Framework
Version 4.5.50709

Installed products:

  • Architecture and Modeling Tools

  • LightSwitch for Visual Studio 2012

  • Office Developer Tools

  • Team Explorer for Visual Studio 2012

  • Visual Basic 2012

  • Visual C# 2012

  • Visual C++ 2012

  • Visual F# 2012

  • Visual Studio 2012 Code Analysis Spell Checker

  • Visual Studio 2012 SharePoint Developer Tools

  • ASP.NET and Web Tools

  • LNDevEnv

  • NuGet Package Manager

  • PreEmptive Analytics Visualizer

  • SQL Server Data Tools

tnw tnw
Answer Source

On the ribbon, select the dropdown that says "Debug" and select Configuration Manager. From there, select the dropdown under "Platform", click New, and now under New platform select x86. Hit ok and close the configuration manager. Try building your project. is a 32-bit assembly so you may have to build your project as x86. If this doesn't work, you can follow the same steps above and select x64 and try again.

AFAIK you shouldn't have to do this, I followed your steps excatly and had no issues building under Any CPU.

You can also try installing entityframework. Right click on references, manage nuget packages, click online and you should see EntityFramework come up in the center column.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download