簡體   English   中英

如何在Package Manager控制台中啟用遷移?

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

我試圖在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

任何幫助都將不勝感激。

不支持從網絡路徑運行遷移。

EF團隊分類:遷移命令需要完全信任才能運行。 因為您是從網絡共享運行的,所以看起來您正在以較低的信任級別運行。 過去,我們決定遷移命令將需要完全信任,因為它降低了實現的復雜性。

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

這意味着您必須將項目放在本地驅動器上,然后才能運行遷移。

事實證明@Stijn的答案的確正確,但是並不能解決問題,解決方案是簡單地將整個項目復制並粘貼到硬盤中,命令將起作用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM