我尝试在已有db配置的解决方案中运行Enable-Migrations
cmd-let,但无论我尝试哪种选项组合,都会出现以下错误:
Exception calling "LoadFrom" with "1" argument(s): "Invalid directory on URL."
At my-project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:5
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsP ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentException
You cannot call a method on a null-valued expression.
At my-project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:5
+ $dispatcher = $utilityAssembly.CreateInstance(
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exception calling "CreateInstanceFrom" with "8" argument(s): "Invalid directory on URL."
At my-project\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:5
+ $domain.CreateInstanceFrom(
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentException
解决方案的结构如下:
Foo.sln
┖─ DbCreator (command line program, transfers data from an old db)
┖─ Foo.Api (WebAPI project, default startup project)
┖─ Foo.Repository (Contains entities and DbContext)
┖─ other utility and test projects
我想要做的是查看DbContext
中的Foo.Repository
(解决方案中唯一的一个),并启用迁移到DbCreator
项目,所以我每次运行exe都可以运行迁移。
我正在使用VS 2015和EF 6.1.3。