2015-03-17 17 views
8

È possibile eseguire EF6 con la versione preliminare ASP.net vNext? EF7 non ha alcune funzionalità di cui ho bisogno, ma mi piacerebbe prototipare la mia applicazione in .NET Core.ASP.net vNext e Entity Framework 6

sto ottenendo il seguente errore:

FileLoadException: A strongly-named assembly is required. 
(Exception from HRESULT: 0x80131044) Unknown location 

FileLoadException: Could not load file or assembly 
'EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089' or one of its dependencies. 
A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) 

so che .NET Core non supporta assemblee fortemente nome, ma per quanto ne so io sto in esecuzione il server nel quadro aspnet50 piuttosto che aspnetcore50.

mio project.json si presenta così:

{ 
    "webroot": "wwwroot", 
    "version": "1.0.0-*", 
    "dependencies": { 
     "EntityFramework": "6.1.1", 
     "Microsoft.AspNet.Mvc": "6.0.0-beta3", 
     /* "Microsoft.AspNet.Mvc.WebApiCompatShim": "6.0.0-beta3", */ 
     "Microsoft.AspNet.Diagnostics": "1.0.0-beta3", 
     "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta3", 
     "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta3", 
     "Microsoft.AspNet.Security.Cookies": "1.0.0-beta3", 
     "Microsoft.AspNet.Server.IIS": "1.0.0-beta3", 
     "Microsoft.AspNet.Server.WebListener": "1.0.0-beta3", 
     "Microsoft.AspNet.StaticFiles": "1.0.0-beta3", 
     "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta3", 
     "Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta3", 
     "Microsoft.Framework.Logging": "1.0.0-beta3", 
     "Microsoft.Framework.Logging.Console": "1.0.0-beta3", 
     "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta3", 
     "Tricycle.SqlPlatform.EntityFramework": "1.0.0-*" 
    }, 
    "commands": { 
     /* Change the port number when you are self hosting this application */ 
     "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000", 
     "gen": "Microsoft.Framework.CodeGeneration", 
    }, 
    "frameworks": { 
     "aspnet50": { 
      "dependencies": { 
       "Tricycle.Studio.ContentManager.Client": "1.0.0-*" 
      } 
     }, 
     //"aspnetcore50": { } 
    }, 
    "exclude": [ 
     "wwwroot", 
     "node_modules", 
     "bower_components" 
    ], 
    "bundleExclude": [ 
     "node_modules", 
     "bower_components", 
     "**.kproj", 
     "**.user", 
     "**.vspscc" 
    ], 
    "scripts": { 
     "postrestore": [ "npm install" ], 
     "prepare": [ "grunt bower:install" ] 
    } 
} 

L'EF classi sono definite in un progetto separato (Tricycle.Studio.ContentManager.Client) con il seguente project.json:

{ 
    "version": "1.0.0-*", 
    "dependencies": { 
     "EntityFramework": "6.1.1", 
    }, 

    "frameworks": { 
     "aspnet50": { 
      "dependencies": { 
       "System.Data.Common": "1.0.0-beta2", 
       "System.Data.SqlClient": "1.0.0-beta2" 
      } 
     }, 
     //"aspnetcore50" : { 
     // "dependencies": { 
     //  "System.Runtime": "4.0.20-beta-22523" 
     // } 
     //} 
    } 
} 

risposta

9

Non è possibile utilizzare Microsoft.AspNet.Identity.EntityFramework con EF6 perché dipende da EF7.

In base al file project.json, il runtime caricherà sia EF6 che EF7 (a causa dell'identità). Il comportamento è imprevedibile.

Inoltre, non combinare i pacchetti beta2 e beta3. Questo è un problema garantito.

+0

Grazie! Rimozione di Microsoft.AspNet.Identity.EntityFramework sembra averlo risolto. Per quanto riguarda la beta2/3, quei pacchetti sembrano essere disponibili solo in beta2. – Grokys

+0

Ah, bella scoperta, @Victor. Tutti i nuovi giocattoli in startup mi hanno fatto trascurare questo. +1 –