dotnetcore-entityframework-api icon indicating copy to clipboard operation
dotnetcore-entityframework-api copied to clipboard

PowerShell cmdlets error on initial Database Migration creation

Open fmorriso opened this issue 6 years ago • 1 comments

The following PowerShell cmdlet, executed in the Package Manager Console of Visual Studio 2017 Enterprise (15.2.26430.14) with the Default Project: dropdown listbox set to Scheduler.API causes an error:

Add-Migration -Name Initial -Project Scheduler.API

Startup project 'Scheduler.Model' targets framework '.NETStandard'. This framework is not intended for execution and may fail to resolve runtime dependencies. If so, select a different startup project and try again. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. File name: 'Microsoft.EntityFrameworkCore.Design, Culture=neutral, PublicKeyToken=null' at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String contentRootPath, String dataDirectory, String rootNamespace, String environment)

I have updated all NuGet packages in all 3 projects to the latest editions (July 1, 2017).

fmorriso avatar Jul 01 '17 12:07 fmorriso

@fmorriso simply try to cd to path of the Scheduler.API project and run the following commands:

  1. Add-Migration Initial
  2. Update-Database

add-migration

chsakell avatar Jul 02 '17 18:07 chsakell