3

I'm trying to run the Enable-Migrations cmd-let in a solution with an already existing db configuration, but no matter what combination of options I try, I get the following error:

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

The solution is structured like this:

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

What I'd like to do, is to look at the DbContext in Foo.Repository (the only one in the solution), and enable migrations into the DbCreator project, so I can run the migrations every time I run the exe.

I'm using VS 2015 and EF 6.1.3.

1 Answer 1

2

Its a know issue, for workaround have a look at 1950#issue

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the pointer. I managed to work around it by doing a complete re-structure of my EF code, too (since migrations worked in a clean project) but that might of course not be feasible to anyone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.