0

In entity framework core 1.0 RC1 when I published a website, it generated a ef.cmd file, I can ran ef database update to update the product database. How can I do it in RC2 when there is no ef.cmd file.

1 Answer 1

1

With RC2, you need to install the tooling via your project.json file, then issue dotnet restore. Here is a sample project.json which also brings in EntityFrameworkCore.SQLite:

{
    "version": "1.0.0-*",
        "buildOptions": {
          "emitEntryPoint": true
        },

    "dependencies": {
      "Microsoft.NETCore.App": {
        "type": "platform",
        "version": "1.0.0-rc2-3002702"
      },

      "Microsoft.EntityFrameworkCore.Tools": {
        "type": "build",
        "version": "1.0.0-preview1-final"
      },

      "Microsoft.EntityFrameworkCore.SQLite": "1.0.0-rc2-final",
      "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    },

    "tools": {
      "Microsoft.EntityFrameworkCore.Tools": {
        "imports": ["portable-net451+win8"],
        "version": "1.0.0-preview1-final"
      }
    },

    "frameworks": {
      "netcoreapp1.0": {
        "imports": "portable-net451+win8"
      }
    }
}

The important parts here are:

"Microsoft.EntityFrameworkCore.Tools": {
    "type": "build",
    "version": "1.0.0-preview1-final"
}

And

"tools": {
  "Microsoft.EntityFrameworkCore.Tools": {
    "imports": ["portable-net451+win8"],
    "version": "1.0.0-preview1-final"
  }
},

These tell the dotnet restore command to download the tooling for entity framework. Now you'll be able to use the .NET Core CLI Entity Framework functionality.

This will let you do things like:

$ dotnet ef migrations add myMigration
$ dotnet ef database update
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.