【发布时间】:2020-09-12 02:06:58
【问题描述】:
每次我尝试使用我的 Nuget 包控制台执行 Scaffold-DbContext 时,我都会收到此异常并且似乎无法通过它。请帮我解决它。
Update-Database
& : File C:\Users\gcobanim\source\repos\eNtsaRegistrationTraining\packages\Microsoft.EntityFrameworkCore.Tools.3.1.3\tools\init.ps1 cannot be loaded because its operation is blocked by software restriction policies, such as
those created by using Group Policy.
At line:1 char:45
+ ... rgs+=$_}; & 'C:\Users\gcobanim\source\repos\eNtsaRegistrationTraining ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
No pending explicit migrations.
Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.
You can use the Add-Migration command to write the pending model changes to a code-based migration.
// 添加-迁移类对象。
namespace eNtsaRegistrationTraining.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class eNtsaRegistration2020 : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}
【问题讨论】:
标签: c# sql-server asp.net-mvc nuget-package group-policy