efcore: Enable-migrations error
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.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 51 (15 by maintainers)
Same issue here.