简体   繁体   English

添加迁移命令仅提示“ScriptHalted”

[英]Add-Migration command only prompt “ScriptHalted”

I'm trying to learn how to make App.Net Core application using Razor pages, using this tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-3.0&tabs=visual-studio我正在尝试使用本教程学习如何使用 Razor 页面制作 App.Net Core 应用程序: https://docs.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.在我制作了电影 model 并成功搭建后,我尝试进行数据库的初始迁移。

However, every time I'm using the command Add-Migration , it just prompts ScriptHalted , even when using the verbose option, same with Update-Database .但是,每次我使用命令Add-Migration时,它只会提示ScriptHalted ,即使使用详细选项时也是如此,与Update-Database相同。

I tried other commands like Enable-Migration and they seems to work, but not the two I need.我尝试了其他命令,例如Enable-Migration ,它们似乎可以工作,但不是我需要的两个。

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 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.简单来说,错误来自 Windows 7 使用的旧版本 PowerShell。 Updating it seems to work now.现在更新它似乎工作。

The problem is the version of powershell.问题是 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. Win7上的powershell是2.0,而PM是基于powershell.so,在我将我的powershell版本升级到5.1后,它工作了

here you can look at version https://docs.microsoft.com/zh-cn/powershell/scripting/install/installing-windows-powershell?view=powershell-6这里你可以看看版本https://docs.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我下载的是https://www.microsoft.com/en-us/download/details.aspx?id=54616

I came across this error today.我今天遇到了这个错误。 As others had said it's about upgrading the Powershell on a Windows 7 machine.正如其他人所说,这是关于在 Windows 7 机器上升级 Powershell。 Here is the link that has worked for me.这是对我有用的链接。

https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/wmf/setup/install-configure?view=powershell-7.1 https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/wmf/setup/install-configure?view=powershell-7.1

After restarting the PC, the update-database worked as expected.重新启动 PC 后,更新数据库按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM