Enable-migrations error
See original GitHub issueWhen 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:
- Created 8 years ago
- Comments:51 (15 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue here.
in package manager console Import-Module (your project path)\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1