Add-Migration 命令仅提示“ScriptHalted"

Add-Migration command only prompt quot;ScriptHaltedquot;(Add-Migration 命令仅提示“ScriptHalted)

本文介绍了Add-Migration 命令仅提示“ScriptHalted"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用本教程学习如何使用 Razor 页面制作 App.Net Core 应用程序:https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-3.0&tabs=visual-studio

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

在我制作好Movie模型并搭建成功后,我尝试进行数据库的初始迁移.

After I made the Movie model and scaffold it successfully, I try to make the initial migration of the database.

但是,每次我使用命令 Add-Migration 时,它只会提示 ScriptHalted,即使使用详细选项时,与 Update- 相同数据库.

However, every time I'm using the command Add-Migration, it just prompts ScriptHalted, even when using the verbose option, same with Update-Database.

我尝试了其他命令,例如 Enable-Migration,它们似乎可以工作,但不是我需要的两个.

I tried other commands like Enable-Migration and they seems to work, but not the two I need.

我有什么遗漏吗?

在我看来,我完美地遵循了教程,并试图在这里找到答案,但我没有提出任何解决方案.

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

简单来说,错误来自 Windows 7 使用的旧版本的 PowerShell.现在更新它似乎可以工作了.

In simple, the error was coming from an older version of PowerShell that Windows 7 use. Updating it seems to work now.

这篇关于Add-Migration 命令仅提示“ScriptHalted"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Add-Migration 命令仅提示“ScriptHalted"

基础教程推荐