2013-06-05 132 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

相關問題