Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 asked — many 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
like image 236
gfullam Avatar asked Apr 01 '14 20:04

gfullam


1 Answers

I had the same problem and resolved it by adding a reference to Entity Framework. This is done by right clicking "Reference" in Solution Explorer and selecting "Add Referece" Next browse to C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE. Choose EntityFramework.dll.

like image 74
Daniel Avatar answered Nov 12 '22 23:11

Daniel