NuGet doesn't add section tag for EntityFramework in webconfig


What my problem is

I started using the last version of EntityFramework in my project by entering the two following commands in NuGet Package Manager Console.

Install-Package EntityFramework -projectname X

Although it said that the package was successfully installed, the below error is shown in the browser.

The configuration section 'entityFramework' cannot be read because it is missing a section declaration

After some researches I found out that the section tag must be added to the webconfig file by NuGet installer. Nonetheless, it didn't!

What I've tried to resolve the issue

So, searching the google I found the section tag which must be added for EntityFramework. I replaced the version value with the version of my acctual library and added it at the beginning of configuration tag.

     <section name="entityFramework"
     EntityFramework, Version=6.2.0, Culture=neutral, 
     PublicKeyToken=b77a5c561934e089" />

The next problem that I am confronted with

It seems the added line resolves the first problem, but it causes another one, and I cannot understand what the problem really is! When I debug the code the following error is cached

private EFDbContext context = new EFDbContext();


Could not load file or assembly 'EntityFramework, Version=6.2.0, >Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. >The located assembly's manifest definition does not match the assembly >reference. (Exception from HRESULT: 0x80131040)

I will be glad if someone tells me what the problem really is. The cited error looks completely wrong, because the version of the section tag corresponds the version of the installed EntityFramework.

Thanks for your impending, constructive solutions.

asked on Stack Overflow Sep 21, 2019 by Retro Code

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0