1

我正在尝试在 MVC4,Entity Framework 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

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

4

2 回答 2

5

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

EF Team Triage:迁移命令需要完全信任才能运行。因为您是从网络共享运行的,所以看起来您运行的是较低的信任级别。过去,我们决定迁移命令需要完全信任,因为它降低了实现的复杂性。

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

这意味着您必须将项目放在本地驱动器上,然后才能运行迁移。

于 2013-06-05T11:44:40.507 回答
0

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

于 2013-06-05T12:00:40.530 回答