質問

私はちょうどEF 5と搭乗し、彼らのコード最初の移行ツールを使用していますが、移行を有効にしようとするとエラーが発生したようです。

Package ManagerコンソールにEnable-Migrationsを入力してから、

現在のプロジェクトで見つかったDBContextから派生するクラスはありません。
生成された設定クラスを編集して、マイグレーションを有効にするコンテキストを指定します。
Project MyApp.mvcuiに対して有効になっているコード最初の移行。

MIGRationsフォルダとMVCUIプロジェクトに設定クラスを作成します。これは、My DBContextがmyapp.domainというクラスライブラリプロジェクトに住んでいます。それはそのプロジェクトでそれをすべて行っておくべきであり、私のDBContextを見つける問題がないはずです。

役に立ちましたか?

解決

Oh wow, nevermind. I'm dumb.

In the Nuget package manager console there is a dropdown menu at the top labeled "Default Project:". Make sure you set that to the project you want to run the command against.

Hopefully this helps someone else avoid my embarrassing mistake.

他のヒント

There are actually 3 ways to make Nuget commands run in a specific project:

  1. [Package Manager Console] Set the active project in the dropdown at the top of the console toolwindow
  2. [Package Manager Console] Look for a parameter to specify the project. For some cmdlets I've seen -ProjectName and some use -Project
  3. [Solution Explorer] Right-click the project you want, and use the graphical package manager window (Manage NuGet Packages...).
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top