15

When I was creating a Controller and a View by MVC Controller with views, using Entity Framework I got an error.

The Error is:

There was an error running the selected code generator: 'Could not load file or assembly Microsoft.EntityFrameworkCore, version = 2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' the located assembly's manifest definition does not match the assembly reference The error image

Creating MVC Controller with views, using Entity Framework: Creating MVC Controller with views, using Entity Framework

How can I solve this problem?

I use Visual Studio Version 15.5.2 and version of Microsoft.AspNetCore.All is 2.0.0

x19
  • 8,277
  • 15
  • 68
  • 126

8 Answers8

9

I updated the Microsoft.AspNetCore.All to version 2.0.3 and now it does work right.

x19
  • 8,277
  • 15
  • 68
  • 126
6

Go to NugetPackage Manager and update the Microsoft.AspNetCore.All package

Sajithd
  • 529
  • 1
  • 5
  • 11
4

For me none of the above solutions worked. I had to add Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Design packages even though I have Microsoft.AspNetCore.All package added to my project.

Edit project in VS 2017 and add these lines

<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" /> 
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.3" />
Trinidad
  • 2,756
  • 2
  • 25
  • 43
Crennotech
  • 521
  • 5
  • 8
  • Same solution works also in 2019 when adding a scaffolded item and dotnet-aspnet-codegenerator-design.dll throws "The located assembly's manifest definition does not match the assembly reference". Just add those packages in their relevant version to your solution. – Trinidad Jun 02 '20 at 22:05
1

Update your packages or it can happen when you have an older SDK. Download a new .NET Core SDK and runtime from www.microsoft.com/net

juFo
  • 17,849
  • 10
  • 105
  • 142
0

I had a similar issue but mine was something with the versioning of visual studio.

I went to Visual Studio Installer and it notified me that I had to restart my computer

Neil Busse
  • 139
  • 8
0

I got this same error:

error running selected code generator

Running Preview 2019 and .NET Core 3.

I moved the Nuget pkg sources up in my list.

I was attemping to add a new Controller and I would get this error every time.

I also noticed that for some reason I chose not to set up SSL but I had the setting in my launchSettings.json.

I deleted the setting for ssl and built the app and ran it. After the successful run I could add the Controller without the error.

raddevus
  • 8,142
  • 7
  • 66
  • 87
0

enter image description here

Follow these Steps:-

From Tools

  • Select NuGet Package Manager -> Manage NuGet Packages For Solution click on ->Updates Select the checkbox Select All ->Select Your Project from right hand side -> Click on Upadate
-1

VS2019PreviewHaving the same error, after downloaded VS2019"PREVIEW" and then opened a core 3.0 project there I was able to scaffold content no errors at all..

Gabor Nagy
  • 19
  • 2