question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable-migrations error

See original GitHub issue

When executing migrations commands such as Enable-Migrations, Add-Migration, etc. the following error is encountered.

Exception calling “LoadFrom” with “1” argument(s): “The specified path, file name, or both are too long. The fully qualified file name must be les s than 260 characters, and the directory name must be less than 248 characters.”

The issue is due to a NuGet bug which is tracked by https://github.com/NuGet/Home/issues/528.

🌟 Workarounds 🌟

  • Install an updated NuGet client that resolves this issue https://nuget.codeplex.com/releases/view/615507
  • As a workaround, you can download this patched version of EntityFramework.psm1, copy it into the packages\EntityFramework.6.1.3\tools directory, restart Visual Studio, and try again.
  • An alternate workaround is to unload other projects that reference Entity Framework (so that the only loaded project that references Entity Framework is the one that contains your EF model).

Details

Full details of the error are…

Exception calling "LoadFrom" with "1" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be les
s than 260 characters, and the directory name must be less than 248 characters."
At D:\helloworld\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:5
+     $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsP ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PathTooLongException

You cannot call a method on a null-valued expression.
At D:\helloworld\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): "The specified path, file name, or both are too long. The fully qualified file name m
ust be less than 260 characters, and the directory name must be less than 248 characters."
At D:\helloworld\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:5
+     $domain.CreateInstanceFrom(
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : PathTooLongException

No path is longer than 200 on my harddisk, so I can’t understand why this problem will happen.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:51 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
unt1tledcommented, May 4, 2015

Same issue here.

0reactions
amirhaghajanicommented, Sep 30, 2017

in package manager console Import-Module (your project path)\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable -migration not working - ASP.NET MVC
I am trying to use migration for the database but it does not work. When I type enable - migration, it gives me...
Read more >
Entity Framework Code First: Enable-Migrations error
1 Answer 1 ... It turns out the issue is that you absolutely need an App.config file with your connection string in the...
Read more >
Prbolem with "enable-migrations" - Microsoft Q&A
The error message indicates that you're attempting to run to load the ClassLibrary2 assembly from a network location such as a UNC path....
Read more >
error to enable Enable-Migrations tool - Microsoft Q&A
Hello, Despite changing the version of the NuGet Npgsql (to 4.1.3) I end up always getting an error on the low-level assembly "System....
Read more >
entity framework 6 migrations error · Issue #1881 · dotnet/ef6
This issue has been closed because EF6 is no longer being actively developed. We are instead focusing on stability of the codebase, which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found