1

I am trying out an existing .NET 4.0 solution in VS2012 on a test machine (that only has VS2012 and SQL Server 2008 installed), and am getting the above error when I try to use the lambda syntax with the Include extension method.

The existing version of the solution has a reference to EntityFramework.dll, which is the one I had to add to use the Include method, but the upgraded version I'm looking at in VS2012 does not have such a reference, nor can I find a DLL of that name in the location it was on the other machine. The using statement for System.Data.Entity is greyed out, as ReSharper thinks it isn't needed. Don't know why.

Sample code: This is what is in the existing solution...

using (var context = new RSSFeedsEntities()) {  
  WebSite someSite = context.WebSites.Include(w => w.Feeds).FirstOrDefault(w => w.WebSiteID == 1);  
}

Any idea how to solve this? Thanks

2
  • 1
    Can you add sample code? Commented Oct 11, 2012 at 20:06
  • Added. As I pointed out before, this code works fine in the VS2010 version, and is standard stuff. Thanks Commented Oct 11, 2012 at 21:57

1 Answer 1

2

Ah ha! Found the answer.

Microsoft, in their, ahem, wisdom, made the (in my opinion) blindingly stupid decision not to have Entity Framework install like other bits of the development rack, but instead made the recent versions only available as NuGet packages. Why on earth they did this is beyond me, as I now have to install EF separately for every solution, instead iof installing it cone and having it available immediately.

Anyway, I used the NuGet package manager to install EF 5.0, and the error went away.

Hope this helps someone.

Sign up to request clarification or add additional context in comments.

1 Comment

They did this so that EF can be a standalone download and more easily referenced/deployed instead of having to go to every server where you want to deploy your application and make sure EF is installed. Additionally, once it's added as a nuget package, any other dev working on the solution doesn't also have to go through the hassle of downloading EF just to run the solution, they simply rebuild it and nuget takes care of pulling in the dependencies. Yet another advantage is the upgrade path but not enough room in comments to discuss that part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.