Reputation: 8783
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
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
Upvotes: 15
Views: 20912
Reputation: 121
Follow these Steps:-
From Tools
Upvotes: 0
Reputation: 519
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" />
Upvotes: 4
Reputation: 19
Having 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..
Upvotes: -1
Reputation: 9077
I got this same error:
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.
Upvotes: 0
Reputation: 18567
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
Upvotes: 1
Reputation: 149
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
Upvotes: 0
Reputation: 557
Go to NugetPackage Manager and update the Microsoft.AspNetCore.All package
Upvotes: 6
Reputation: 8783
I updated the Microsoft.AspNetCore.All
to version 2.0.3
and now it does work right.
Upvotes: 10