In my Framework Seed method entity, I have the following line to get a file from another project:
var filePath = new DirectoryInfo(HostingEnvironment.ApplicationPhysicalPath).Parent.FullName + "\\Com.ProjectX\\companies.xls";
This works when an HttpContext is available, for example, when using this action method to start it:
public ActionResult About() { var configuration = new Com.EntityModel.Configuration(); var migrator = new System.Data.Entity.Migrations.DbMigrator(configuration); migrator.Update(); return View(); }
However, this does not work when I execute Update-Database from the package manager console (the file was not found and it is difficult to debug it, because I also cannot stop doing this.
I would like to use the Update-Database command and work without an HttpContext. How can I get the way?
source share