如何启用在Package Manager控制台迁移? [英] How do I Enable Migrations in the Package Manager Console?

查看:449
本文介绍了如何启用在Package Manager控制台迁移?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想能够在MVC4,实体框架5.00迁移,但是当我输入它引发以下错误的命令:

I'm trying to enable migrations in MVC4, Entity Framework 5.00, however when I input the command it throws the following error:

Cannot determine a valid start-up project. Using project 'EFMigrations' instead. Your configuration file and working directory may not be set as expected. Use the -StartUpProjectName parameter to set one explicitly. Use the -Verbose switch for more information.
    Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file://\\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.5.0.0\tool
    s\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
    At \\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.6.0.0-beta1\tools\EntityFramework.psm1:669 char:62
    +     $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    You cannot call a method on a null-valued expression.
    At \\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.6.0.0-beta1\tools\EntityFramework.psm1:670 char:50
    +     $dispatcher = $utilityAssembly.CreateInstance <<<< (
        + CategoryInfo          : InvalidOperation: (CreateInstance:String) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull

    Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file://\\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.
    5.0.0\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
    At \\s01\data\Documents\Visual Studio 2010\Projects\EFMigrations\packages\EntityFramework.6.0.0-beta1\tools\EntityFramework.psm1:698 char:31
    +     $domain.CreateInstanceFrom <<<< (
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

任何和所有帮助将是AP preciated。

any and all help would be appreciated.

推荐答案

从网络路径中运行迁移不受支持。

Running migrations from a network path is unsupported.

EF团队分流:的迁移命令需要完全信任才能运行。因为您是从网络共享上运行它看起来像你是在一个较低的信任级别运行。在过去,我们已经取得的迁移命令将需要完全信任,因为它降低了实现的复杂性决定的。

EF Team Triage: The migrations commands require full trust to run. Because you are running from a network share it looks like you are running in a lower trust level. In the past we have made the decision that the migrations commands would require full trust because it reduces the complexity of the implementation.

<一个href=\"http://entityframework.$c$cplex.com/workitem/856\">http://entityframework.$c$cplex.com/workitem/856

这意味着你必须把你的项目一个本地驱动器上,那么你就可以运行迁移。

This means you have to put your project on a local drive, then you'll be able to run migrations.

这篇关于如何启用在Package Manager控制台迁移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆