2013-06-05 133 views
1

我想能够在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 

任何和所有帮助将不胜感激。

回答

5

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

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.

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

这意味着你必须把你的项目在本地驱动器上,然后你就可以运行迁移。

+0

解决了我的问题(没有解决,但现在我知道它至少是什么)然而,我必须说,在这个时代,我发现完全和非常疯狂的是,会做出这样的决定,这个决定可能会瘫痪主要项目左右对中,cmon MS你可以做得比这更好。 – shawty

+0

是的,结果是网络共享上的项目导致了这个问题。它正在完成请求,但仍然抛出错误消息。感谢解决方案 – Jawad

0

事实证明,@斯泰恩的答案确实是正确的,但是它并没有提供一个解决问题的办法,解决的办法就是简单的复制和整个项目粘贴到你的硬盘驱动器和该命令将工作

+0

我认为这是明显的下一步。我会将其添加到我的答案。 – Stijn

+0

你可以自由这样做,但为什么近一年后你不接受我的答案? – Stijn

相关问题