0

I want reference to EF source codes projects instead its assemblies in my project for some tracing goals, so I downloaded EF source codes from CodePlex, and add it to my project, it compiles well by .NET Framework 4.5, but my project is in .NET Framework 4(I have to stay with .NET4), when I change its target framework to .NET 4 it could not compile successfully, I get some errors, e.g:

Error 29 The type or namespace name 'DatabaseGeneratedOption' could not be found (are you missing a using directive or an assembly reference?) C:\Users\8060509\Downloads\entityframework-899f1fb43a0d92c22ea381edafc50a350e391a5a\src\EntityFramework\ModelConfiguration\Configuration\Properties\Primitive\Api\BinaryPropertyConfiguration.cs 102 13 EntityFramework

and

Error 1 The type or namespace name 'ColumnAttribute' could not be found (are you missing a using directive or an assembly reference?) C:\Users\8060509\Downloads\entityframework-899f1fb43a0d92c22ea381edafc50a350e391a5a\src\EntityFramework\ModelConfiguration\Conventions\Configuration\Property\ColumnAttributeConvention.cs 13 61 EntityFramework

and ...

What is the solution?

2
  • What evidence do you have that the version of the source you downloaded supports .net 4? In other words, is there any reason to believe that what you are attempting is actually possible? Commented Oct 20, 2014 at 8:15
  • 1
    @DavidHeffernan The official NuGet package does support .NET 4.0. Commented Oct 20, 2014 at 8:17

2 Answers 2

2

Don't change the target framework of the "Debug" or "Release" configurations. Entity Framework is already set up with usable "DebugNet40" and "ReleaseNet40" configurations that you should be using instead. Those configurations, in addition to setting the target framework, also define the required macros that EF uses to know which code to include in the .NET 4.0 version.

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

2 Comments

Where and how can I config EF to use DebugNet40 or ReleaseNet40?
From the configuration drop down if you are building in VS, or by specifying the config on the command line if builing with msbuild
0

I think DatabaseGeneratedOption doesn't exist in EF before 4.5. Change your target framework to 4.5 and it should do well.

1 Comment

As I said in my question, I have to work with .NET4.

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.