1

I am currently learning how to work with Razor Pages using the following tutorial on Microsoft's Website:

Getting Started with Razor Pages in ASP.NET Core

In the Add a Model section of the tutorial, it shows how to Scaffold using the Command Prompt. However, upon executing the command, I am met with the following Error:

Building project ...
Finding the generator 'razorpage'...
Running the generator 'razorpage'...
Attempting to compile the application in memory.
Attempting to figure out the EntityFramework metadata for the model and DbContext: 'Movie'
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)
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
RunTime 00:00:49.26

As far as I can tell, my code in VSC17 is as prescribed within the tutorial. I also just updated VSC17 right after creating the project file (But before attempting to Scaffold), if that may have any effect. Thanks in advance.

Append: I was able to successfully execute Add-Migration Initial prior to posting this question. It's when I have to enter the following command into the prompt that leads to issues:

dotnet aspnet-codegenerator razorpage -m Movie -dc MovieContext -udl -outDir Pages\Movies --referenceScriptLibraries

SOLVED

It was the update of VSC17 that messed up the dependencies. Created a new Project, and everything worked like a charm. Hashtag face in palm...

  • Possible duplicate of [Add-Migration Error in Entity Framework Core](https://stackoverflow.com/questions/49510374/add-migration-error-in-entity-framework-core) – devlin carnate May 09 '18 at 15:57
  • @devlincarnate I was able to execute Add-Migration without error. It's the following step that's creating the error. – OPM eStudio May 09 '18 at 16:10

0 Answers0