dotnet core - Entity Framework - problems with creation of migration - cant find SDK

.net-core c# entity-framework-core

Question

I have the latest Visual Studio 2019 preview 3.1.200-preview-014883.

I am trying to run the creation of a migration using this:

dotnet ef migrations add INITIAL --context CATALOGContext -s ../Jobsledger.API

but am getting the message:

Install the [3.1.200] .NET Core SDK or update [C:\Users\simon\OneDrive\Documents\1.0 - AURELIA\1.0 - JobsLedgerSPA -ASPNET CORE 3.1\JobsLedger.CATALOG\global.json] with an installed .NET Core SDK:
  3.1.101 [C:\Program Files\dotnet\sdk]
  3.1.200-preview-014883 [C:\Program Files\dotnet\sdk]

I've upgraded Visual Studio - and updated global.json with the following:

{
    "sdk": {
        "version": "3.1.200"
    }
}

How do I run the migration - what am I missing here as I thought I had the SDK installed with the preview?

UPDATE: I ran the following

dotnet tool install --global dotnet-ef --version 3.0.0 

and got the following:

Install the [3.1.200] .NET Core SDK or update [C:\Users\simon\OneDrive\Documents\1.0 - AURELIA\1.0 - JobsLedgerSPA -ASPNET CORE 3.1\JobsLedger.CATALOG\global.json] with an installed .NET Core SDK:
  3.1.101 [C:\Program Files\dotnet\sdk]
  3.1.200-preview-014883 [C:\Program Files\dotnet\sdk]
PS C:\Users\simon\OneDrive\Documents\1.0 - AURELIA\1.0 - JobsLedgerSPA -ASPNET CORE 3.1\JobsLedger.CATALOG>  

I also ran

dotnet tool install --global dotnet-ef --version 3.0.2

and got the same as above..

1
0
1/28/2020 12:50:43 PM

Popular Answer

Im not sure this has any merit but the first thing I did was remove Visual Studio 2019 preview. Rebooted... and then rerun the migration.

While investigating I read an article by Rick Strahl That had a similar issue. He did say use global.json which I had done however I updated the file to reflect the exact build of the SDK.

{
    "sdk": {
        "version": "3.1.200-preview-014883"
    }
}

Clean install and the correct version in the global.json file and it finally worked. Rick did say this was a terrible idea because you are tied to that version of the sdk. He did outline other options but I did look into the Visual Studio options however VS2019 had been changed.. it works right now.. I'll make it bomb proof later.

0
1/29/2020 12:13:18 AM


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