26

私はMVC4とエンティティフレームワークを初めて使用します。パッケージマネージャーコンソールからこのコマンドを実行すると、次のようになります。

Enable-Migrations -ContextTypeName MyFirstMvcApp.Models.InventoryDbContext

Join-Path:引数がnullであるため、パラメーター'Path'に引数をバインドできません。

次のエラーが発生します。

Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\GitProjects\MyFirstMvcApp\trunk\packages\EntityFramework.6.0.0-alpha2\tools\EntityFramework.psm1:363 char:27
+     $toolsPath = Join-Path <<<<  $installPath tools
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\GitProjects\MyFirstMvcApp\trunk\packages\EntityFramework.6.0.0-alpha2\tools\EntityFramework.psm1:392 char:73
+     $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path <<<<  $toolsPath EntityFramework.PowerShell.Utility.dll))
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

You cannot call a method on a null-valued expression.
At D:\GitProjects\MyFirstMvcApp\trunk\packages\EntityFramework.6.0.0-alpha2\tools\EntityFramework.psm1:393 char:50
+     $dispatcher = $utilityAssembly.CreateInstance <<<< (
    + CategoryInfo          : InvalidOperation: (CreateInstance:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\GitProjects\MyFirstMvcApp\trunk\packages\EntityFramework.6.0.0-alpha2\tools\EntityFramework.psm1:426 char:19
+         (Join-Path <<<<  $runner.ToolsPath EntityFramework.PowerShell.dll),
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

これを修正するにはどうすればよいですか?Visual Studio 2010 UltimateとSP1を使用しており、このリンクにMVC4をインストールしていることに注意してください。

4

14 に答える 14

41

エンティティ フレームワークをアンインストールして再インストールすることで修正されました。他の人の利益のために、ここにコマンドがあります...

アンインストール:

PM> アンインストール-パッケージ EntityFramework -Force

アンインストール後、EntityFramework を再インストールします。

PM> インストール パッケージ EntityFramework -Pre

そこには!修正されました。何が問題を引き起こしたのかはまだわかりませんが。

于 2013-01-22T03:37:47.197 に答える
13

ここですべてのことを試しました。そもそも何が問題なのかを知らずに物事を解決するのは個人的に嫌いです。フォーラムを掘り下げると、これは、スタートアップ プロジェクトが Web アプリである場合にバージョン 6.3.0 で発生した既知のバグのようです。彼らはすでに毎日のビルドでそれを修正しています。それを解決するには、それをインストールする必要があります。

まず、パッケージをアンインストールします。

PM> Uninstall-Package EntityFramework -Force

次に、最新のデイリー ビルドをインストールします (私の場合は次のビルド)。

PM> Install-Package EntityFramework -Version 6.4.0-preview1-19506-01
于 2019-10-25T08:06:38.717 に答える