I'm trying to learn how to make App.Net Core application using Razor pages, using this tutorial : https://learn.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-3.0&tabs=visual-studio
After I made the Movie model and scaffold it successfully, I try to make the initial migration of the database.
However, every time I'm using the command Add-Migration
, it just prompts ScriptHalted
, even when using the verbose option, same with Update-Database
.
I tried other commands like Enable-Migration
and they seems to work, but not the two I need.
Is there anything that I'm missing ?
It seems to me that I followed the tutorial perfectly, and tried to find an answer here, yet I didn't come up with any solutions.
I found the answer in a closed question of the english tutorial page (I was using the french one at first)
https://developercommunity.visualstudio.com/content/problem/753703/package-manager-console-scripthalted.html
In simple, the error was coming from an older version of PowerShell that Windows 7 use. Updating it seems to work now.
The problem is the version of powershell.
powershell on win7 is 2.0,and PM is base on powershell.so,after i upgrade my powershell version to 5.1 ,it work out.
here you can look at version https://learn.microsoft.com/zh-cn/powershell/scripting/install/installing-windows-powershell?view=powershell-6
and what i download is here https://www.microsoft.com/en-us/download/details.aspx?id=54616
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With