-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotes.txt
More file actions
75 lines (40 loc) · 1.76 KB
/
Notes.txt
File metadata and controls
75 lines (40 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
✅ Fix 1 — Use the CORRECT console
You are using Package Manager Console, but your command is for dotnet CLI.
❌ Wrong console:
PM> dotnet ef migrations add InitialDatabase
✔ Correct console:
Use Developer PowerShell or Terminal, NOT Package Manager Console.
In Visual Studio:
View → Terminal → PowerShell or CMD
Then run:
dotnet ef migrations add InitialDatabase
✅ Fix 2 — Install EF Core Tools
Run this in PowerShell/Terminal:
dotnet tool install --global dotnet-ef
If already installed, update it:
dotnet tool update --global dotnet-ef
✅ Fix 3 — Use Package Manager Console version (if you want)
If you want to use Package Manager Console, the command is different:
✔ PMC version:
Add-Migration InitialDatabase
NOT dotnet ef ...
And to apply migration:
Update-Database
⭐ Summary
Console Type Correct Command
Package Manager Console Add-Migration InitialDatabase
Terminal / CMD / PowerShell dotnet ef migrations add InitialDatabase
===========================================================================================================================
Alternative — use Visual Studio Package Manager Console (no global tool needed)
If global tool install fails, you can still create and apply migrations inside Visual Studio using the Package Manager Console (PMC).
In Visual Studio:
Tools → NuGet Package Manager → Package Manager Console
Set Default project dropdown to your EF Core project (StudentsDatabase).
Then run:
# add EF Core tools package to the project (if not already)
Install-Package Microsoft.EntityFrameworkCore.Tools
# create migration (PMC command)
Add-Migration InitialDatabase
# apply migration to DB
Update-Database
Add-Migration / Update-Database are PMC cmdlets and do not require dotnet-ef global tool.