Error when trying to Scaffold a model

1

I'm building a Razor Page app using ASP.NET 2017. When I run the command

dotnet aspnet-codegenerator razorpage -m Activity -dc CongContext -udl -outDir Page\Activities --referenceScriptLibraries

This error appears:

Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I stopped and restarted VS, I've also cleaned and build the solution. Attached jpg shows the code I typed and the results

razor
scaffold
asked on Stack Overflow May 28, 2018 by ATA • edited May 28, 2018 by SearchAndResQ

1 Answer

0

This is because of different versions of packages. Check the 'Dependencies' node of your project. The Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Design must have same 2.0.3 versions.

If not, delete and re-add them from [Tools] menu > [Nuget Package Manager]. Also delete the Migrations folder and repeat instructions as listed here. For more info, you may take a look at this comment

answered on Stack Overflow May 28, 2018 by S.Serp

User contributions licensed under CC BY-SA 3.0