There are two EF7
db-contexts in a MVC6 (beta-7)
project. First of them (let's call it StartupContext
) is in a startup project (MyProject.Startup
). Second (let's call it DataContext
) is in a separate assembly (MyProject.Data
).
There is a command in the project.json
files of the MyProject.Startup
and the MyProject.Data
:
"dependencies": {
"EntityFramework.SqlServer": "7.0.0-beta7",
"EntityFramework.Commands": "7.0.0-beta7",
...
}
"commands": {
"ef": "EntityFramework.Commands"
...
}
I can use it for a database updating like this:
for an updating of the
StartupContext
I run theef
command from a startup folder:dnx ef database update
for an updating of the
DataContext
I run theef
command from a folder of theMyProject.Data
project:dnx ef database update -c DataContext -s MyProject.Startup
It works perfectly but only from sources (from not published project). I get exception like this for an updating of the DataContext
from a published project:
System.IO.FileNotFoundException: Could not load file or assembly "MyProject.Data" or one of its dependencies.
I tried various approaches:
dnx ef database update -c DataContext -s MyProject.Startup
dnx ef database update -c DataContext -s C:\Published\approot\packages\MyProject.Startup
dnx ef database update -c DataContext -s C:\Published\approot\packages\MyProject.Startup\1.0.0\root\
dnx ef database update -c DataContext -s C:\Published\approot\packages\MyProject.Startup\1.0.0\lib\MyProject.Startup.dll
dnx ef database update -c DataContext -s %~dp0approot\packages\MyProject.Startup
dnx ef database update -c DataContext -s %~dp0approot\packages\MyProject.Startup\1.0.0\root\
I also tried to copy the MyProject.Startup.dll
to a folder with the MyProject.Data
but unsuccessfully.
Has anybody else had a similar problem?
How can I update a database and create a migration from a published project?