I created a new class library (package) project (prior to VS 2015 RC used the even worse name of asp.net class library to represent the data layer. Just to be clear this is
I have managed to get round this by creating an old .csproj project which the Enable-Migrations command works. The only difference is that instead of having a separate copy of the files, i have added them all by reference, using the "Add By Link" option when adding an existing file.
Now i can add migrations etc and change the files as needed, and these changes will automatically reflect in my .xproj as it is the same files.
In asp.net 5 project you have to use entity framework 7 and use the ef migration command from command line.
I just done a recap here How can I manage EF 6 migrations in visual studio 2015?
Why does package manager think Enable-Migrations is invalid even though EF6 has been referenced?
Because I assume and am quite sure that ASP.NET 5 projects don't invoke install and uninstall PowerShell scripts inside the packages which EF 6 package has to add the migration commands to package manager console. Your best luck is to try to integrate the command line tool (I believe it is called migrate.exe, not sure) inside the EF6 NuGet package.
EDIT for 1.0.0: Migrator.EF6 now supports 1.0.0.
EDIT for RC2: Migrator.EF6 now supports RC2.
What we need is a dnx command line tool that wraps EF6 and delegates commands to it. That's because DNX projects won't see init.ps1
and install.ps1
that are needed to get Add-Migration
to work (at least for now, see this).
The implementation isn't that hard but no one seems to have given it time so I ended up doing one.
This solution doesn't require a separate .csproj
, the same workflow happens but instead of Update-Database
you'll do dnx ef database update
and similar commands.
Instructions and samples can be found here: Migrator.EF6.
Later on, probably in RTM, you'll be able to use these in DNX projects as well. And that's probably why Microsoft hasn't made one to support EF6 migrations.