简体   繁体   English

如何在Package Manager控制台中启用迁移?

[英]How do I Enable Migrations in the Package Manager Console?

I'm trying to enable migrations in MVC4, Entity Framework 5.00, however when I input the command it throws the following error: 我试图在MVC4,实体框架5.00中启用迁移,但是当我输入命令时,它会引发以下错误:

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

any and all help would be appreciated. 任何帮助都将不胜感激。

Running migrations from a network path is unsupported. 不支持从网络路径运行迁移。

EF Team Triage: The migrations commands require full trust to run. EF团队分类:迁移命令需要完全信任才能运行。 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. 过去,我们决定迁移命令将需要完全信任,因为它降低了实现的复杂性。

http://entityframework.codeplex.com/workitem/856 http://entityframework.codeplex.com/workitem/856

This means you have to put your project on a local drive, then you'll be able to run migrations. 这意味着您必须将项目放在本地驱动器上,然后才能运行迁移。

事实证明@Stijn的答案的确正确,但是并不能解决问题,解决方案是简单地将整个项目复制并粘贴到硬盘中,命令将起作用

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

相关问题 在 Visual Studio 外使用 NuGet 包管理器控制台运行实体框架迁移 - Using NuGet Package Manager console outside Visual Studio to run Entity Framework Migrations 找不到套件管理员控制台 - Package Manager Console not found 使用Package Manager(nuget)时,如何使用非唯一名称指定特定项目? - How do I target a specific project with a non-unique name when using the Package Manager (nuget)? 如何在Lightswitch中启用验证? - How do I enable validation in Lightswitch? 在Visual Studio的Package Manager控制台中调用用户定义的函数 - Calling user defined functions in Package Manager Console in Visual Studio Visual Studio - 包管理器控制台 - 以编程方式运行命令 - Visual Studio - Package Manager Console - Running commands programmatically 从程序包管理器控制台添加自定义nuget源(PowerShell) - Add custom nuget feed from the Package Manager Console (PowerShell) 在Visual Studio中使用程序包管理器控制台中的git - Using git from Package Manager Console in Visual Studio 是否有用于退出或关闭 nuGet 包管理器控制台的键盘快捷键? - Is there a keyboard shortcut for exiting or closing nuGet Package Manager Console? 通过宏插入并运行nuget Package Manager控制台命令 - Insert and run nuget Package Manager Console command through macros
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM