Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 RC Entity Framework 6.1.3 Migrations Error

The pasted below error only occurs when the solution has more than one project that references the EntityFramework. When run the "Enable-Migrations" or "Add-Migration", I received the following error:

New-Object : The value supplied is not valid, or the property is read-only. Change the value, and then try again. At D:\Projetos\Monitoramento\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:757 char:13 + $info = New-Object System.AppDomainSetup -Property @{ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [New-Object], Exception + FullyQualifiedErrorId : SetValueException,Microsoft.PowerShell.Commands.NewObjectCommand The property 'PrivateBinPath' cannot be found on this object. Verify that the property exists and can be set. At D:\Projetos\Monitoramento\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:772 char:9 + $info.PrivateBinPath += ';lib\net45' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound Exception calling "LoadFrom" with "1" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters." At D:\Projetos\Monitoramento\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:\Projetos\Monitoramento\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 must be less than 260 characters, and the directory name must be less than 248 characters." At D:\Projetos\Monitoramento\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:5 + $domain.CreateInstanceFrom( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : PathTooLongException

Output with EntityFramework 6.1.1:

Exception calling "LoadFrom" with "1" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters." At C:\Users\Hudson\Documents\Visual Studio 2015\Projects\WpfApplication4\packages\EntityFramework.6.1.1\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 C:\Users\Hudson\Documents\Visual Studio 2015\Projects\WpfApplication4\packages\EntityFramework.6.1.1\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 must be less than 260 characters, and the directory name must be less than 248 characters." At C:\Users\Hudson\Documents\Visual Studio 2015\Projects\WpfApplication4\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:809 char:5 + $domain.CreateInstanceFrom( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : PathTooLongException

like image 777
Hudson Cavazin Avatar asked May 04 '15 12:05

Hudson Cavazin


5 Answers

Other solution: https://github.com/aspnet/EntityFramework/issues/1950#issuecomment-99164398

Copy this patched version of EntityFramework.psm1.

like image 145
Hudson Cavazin Avatar answered Nov 16 '22 07:11

Hudson Cavazin


I have the same problem :(

My workaround is:

  1. Downgrade Entity Framework to v6.1.1 (at least the new NuGet GUI makes this very easy)
  2. Run the command (for example Add-Migration ...) on the package manager console. It seems to work in this version
  3. Upgrade back to Entity Framework v6.1.3
like image 43
Hannes Sachsenhofer Avatar answered Nov 16 '22 08:11

Hannes Sachsenhofer


Seems to be a common issue, but apparently difficult to repo?

Enable-migrations error #1950

Suggest you add your issue details to the above in the hopes that it can be resolved quickly.

like image 41
Brendan Green Avatar answered Nov 16 '22 08:11

Brendan Green


As per comment by yishaigalatzer on EF bug #1950, NuGet 3.0 RC2 has now been released, which should fix this problem. Simply download the VSIX from codeplex and install it.

This solved the problem for me.

like image 1
Søren Boisen Avatar answered Nov 16 '22 06:11

Søren Boisen


In my case I just:

1. Closed VS.
2. Removed Entity Framework package in packages folder manually.
3. Opened project and restored packages.

That worked for me.

like image 1
Alexander Kin Avatar answered Nov 16 '22 07:11

Alexander Kin