简体   繁体   中英

Entity Framework 7 migrations on beta6

After an upgrade to asp.net5 beta6 release, I can´t execute migrations anymore.

I just create a new project, and these are my settings:

project.json

{
  "webroot": "wwwroot",
  "userSecretsId": "aspnet5-WebApplication11-f079fe46-c31d-4a88-b1d4-e45ae169804b",
  "version": "1.0.0-*",

  "dependencies": {
    "EntityFramework.SqlServer": "7.0.0-beta6",
    "EntityFramework.Commands": "7.0.0-beta6",
    "Microsoft.AspNet.Mvc": "6.0.0-beta6",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta6",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta6",
    "Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta6",
    "Microsoft.AspNet.Authentication.Google": "1.0.0-beta6",
    "Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta6",
    "Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta6",
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta6",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta6",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta6",
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta6",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta6",
    "Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta6",
    "Microsoft.Framework.Configuration.Json": "1.0.0-beta6",
    "Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta6",
    "Microsoft.Framework.Logging": "1.0.0-beta6",
    "Microsoft.Framework.Logging.Console": "1.0.0-beta6",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta6"
  },

  "commands": {
    "web": "Microsoft.AspNet.Hosting --config hosting.ini",
    "ef": "EntityFramework.Commands"
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ],
  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }
}

global.json

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-beta6"
  }
}

dnvm list

C:\Users\paulo.larini>dnvm list

Active Version     Runtime Architecture Location                            Alias                                                                            
------ -------     ------- ------------ --------                            ---
       1.0.0-beta5 clr     x86          C:\Users\paulo\.dnx\runtimes
  *    1.0.0-beta6 clr     x64          C:\Users\paulo\.dnx\runtimes
       1.0.0-beta6 clr     x86          C:\Users\paulo\.dnx\runtimes        def
       1.0.0-beta6 coreclr x64          C:\Users\paulo\.dnx\runtimes
       1.0.0-beta6 coreclr x86          C:\Users\paulo\.dnx\runtimes

the error (using dnx)

PM> dnx . ef migration add mymigration
dnx : System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
At line:1 char:1
+ dnx . ef migration add mymigration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (System.InvalidO...ersion=v4.5.1'::String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
...

If I change the framework to dnx46 in project.json, I get another error:

PM> dnx . ef migration add mymigration
dnx : System.InvalidOperationException: The current runtime target framework is not compatible with 'WebApplication11'.
At line:1 char:1
+ dnx . ef migration add mymigration
....

Just before execute dnx commands we need to change the current path to the application folder:

PM> cd .\src\WebApplication11
PM> dnx . ef migration add mymigration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM