"the term 'add-migration' is not recognized as the name of a cmdlet" visual studio 2019

asp.net-core c# code-first entity-framework-core

Question

enter image description here
enter image description here

I'm trying to use entity frame work core and have a fresh asp.net core project open. When i attempt to install Microsoft.EntityFrameworkCore.SqlServer through nuget package manager i get the following error.

Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0 is not compatible with net461 (.NETFramework,Version=v4.6.1). Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)

When i click this i get sent to .csproj file.

In that file i changed the target framework from <TargetFramework>net461</TargetFramework> to <TargetFramework>netstandard2.1 </TargetFramework> as the error implies.

Doing this gets rid of the error but when i use the command 'add-migration' in package manager console i get this error.

"The term 'add-migration' is not recognized as the name of a cmdlet"

I'm not sure what to do going forward. Please help. I hope i've explained the issue clearly.

Deleting the project.assets file or updating nuget package manger and using the the command "enable-migrations" hasnt worked either.

enter image description here
enter image description here

1
0
10/6/2019 7:46:26 AM

Popular Answer

I have faced the same issue and these steps fixed it..

1) Tools -> Nuget Package Manger -> Package Manager Settings

2) General Tab

3) Clear All NuGet Cache(s)

4) Restart Visual Studio

1
10/12/2019 3:45:24 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow