c# - Cannot enable migrations in library project -


i installed ef6 in library project. in app.config, added connection string local db. ef configuration, using ef code based config : app.config:

<entityframework codeconfigurationtype="com.ef.example.efrecordconfiguration, myproject.example"> </entityframework> 

efrecordconfiguration.cs :

public class efrecordconfiguration : dbconfiguration {     public efrecordconfiguration()     {         setdefaultconnectionfactory(new system.data.entity.infrastructure.sqlconnectionfactory());         setproviderservices("system.data.sqlclient", system.data.entity.sqlserver.sqlproviderservices.instance);     } } 

i added attribute [dbconfigurationtype(typeof(efrecordconfiguration))] context class.

when use command enable-migrations -verbose, here result :

pm> enable-migrations -verbose using startup project 'myproject.example'. using nuget project 'myproject.example'. checking if context targets existing database... system.data.entity.migrations.infrastructure.migrationsexception:   migrations configuration type 'com.ef.example.migrations.configuration'  not found in assembly 'myproject.example'. à system.data.entity.utilities.typefinder.findtype(type basetype, string typename, func`2 filter, func`2 notype, func`3 multipletypes, func`3 notypewithname, func`3 multipletypeswithname) à  system.data.entity.migrations.utilities.migrationsconfigurationfinder.findmigrat ionsconfiguration(type contexttype, string configurationtypename, func`2 notype,  func`3 multipletypes, func`3 notypewithname, func`3 multipletypeswithname) à system.data.entity.migrations.design.toolingfacade.baserunner.findconfiguration() à system.data.entity.migrations.design.toolingfacade.scaffoldrunner.run() à system.appdomain.docallback(crossappdomaindelegate callbackdelegate) à system.appdomain.docallback(crossappdomaindelegate callbackdelegate) à system.data.entity.migrations.design.toolingfacade.run(baserunner runner) à system.data.entity.migrations.design.toolingfacade.scaffoldinitialcreate(string language, string rootnamespace) à system.data.entity.migrations.enablemigrationscommand.<>c__displayclass2.<.ctor>b__0() à system.data.entity.migrations.migrationsdomaincommand.execute(action command) migrations configuration type 'com.ef.example.migrations.configuration'  not found in assembly 'myproject.example'. 

the folder migrations , file configuration.cs added in project, however, error. when try add migration, same error, migration file not added :

pm> add-migration initialcreate -verbose using startup project 'myproject.example'. using nuget project 'myproject.example'. system.data.entity.migrations.infrastructure.migrationsexception: no  migrations configuration type found in assembly 'myproject.example'. (in  visual studio can use enable-migrations command package manager  console add migrations configuration). à system.data.entity.utilities.typefinder.findtype(type basetype, string typename, func`2 filter, func`2 notype, func`3 multipletypes, func`3 notypewithname, func`3 multipletypeswithname) à system.data.entity.migrations.utilities.migrationsconfigurationfinder.findmigrationsconfiguration(type contexttype, string configurationtypename, func`2 notype, func`3 multipletypes, func`3 notypewithname, func`3 multipletypeswithname) à system.data.entity.migrations.design.toolingfacade.baserunner.findconfiguration( ) à system.data.entity.migrations.design.toolingfacade.scaffoldrunner.run() à system.appdomain.docallback(crossappdomaindelegate callbackdelegate) à system.appdomain.docallback(crossappdomaindelegate callbackdelegate) à system.data.entity.migrations.design.toolingfacade.run(baserunner runner) à system.data.entity.migrations.design.toolingfacade.scaffold(string  migrationname, string language, string rootnamespace, boolean ignorechanges) à system.data.entity.migrations.addmigrationcommand.execute(string name, boolean force, boolean ignorechanges) à system.data.entity.migrations.addmigrationcommand.<>c__displayclass2.<.ctor>b__0() à system.data.entity.migrations.migrationsdomaincommand.execute(action  command) no migrations configuration type found in assembly 'myproject.example'.  (in visual studio can use enable-migrations command package manager  console add migrations configuration). 

the default project selected 'myproject.example' in package manager console. tried same (same configuration) in console project, no error.

is there forgot in ef configuration ?

edit: found problem : activated assembly signing library project, , seems problem. can make ef migrations system works strong-named assembly ?

i found workaround : entityframework codefirst migrations in dll strong name

however, how avoid add assembly in gac, restart vs , add migration ?

edit: not possible.


Comments