Visual Studio 2015 RCentity framework6.1.3迁移错误

仅当解决方案具有多个引用EntityFramework的项目时,才会发生粘贴的以下错误。 运行“启用 – 迁移”或“添加迁移”时,我收到以下错误:

New-Object:提供的值无效,或者属性是只读的。 更改值,然后重试。 在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在此对象上找不到属性“PrivateBinPath”。 validation该属性是否存在且可以设置。 在D:\ Projetos \ Monitoramento \ packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1:772 char:9 + $ info.PrivateBinPath + =’; lib \ net45’+ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidOperation 🙁 🙂 [],RuntimeException + FullyQualifiedErrorId:PropertyNotFound使用“1”调用“LoadFrom”的exception“argument(s):”指定的路径,文件名或两者都太长。完全限定的文件名必须少于260个字符,目录名必须少于248个字符。 在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你不能调用关于空值表达式的方法。在D:\ Projetos \ Monitoramento \ packages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1:781 char:5 + $ dispatcher = $ utilityAssembly.CreateInstance(+ ~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ClassInfo:InvalidOperation 🙁 🙂 [ ],RuntimeException + FullyQualifiedErrorId:InvokeMethodOnNull使用“8”参数调用“CreateInstanceFrom”的exception:“指定的路径,文件名或两者都太长。完全限定的文件名必须少于260个字符,并且目录名称必须少于248个字符。“在D:\ Projetos \ Monitoramento \ pac kages \ EntityFramework.6.1.3 \ tools \ EntityFramework.psm1:809 char:5 + $ domain.CreateInstanceFrom(+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~ + CategoryInfo:未指定:(:) [],MethodInvocationException + FullyQualifiedErrorId:PathTooLongException

使用EntityFramework 6.1.1输出:

使用“1”参数调用“LoadFrom”的exception:“指定的路径,文件名或两者都太长。完全限定的文件名必须少于260个字符,目录名称必须少于248个字符“。 在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您无法在空值表达式上调用方法。在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使用“8”参数调用“CreateInstanceFrom”的exception:“指定的路径,文件名或两者都太长了。完全限定的文件名必须少于260个字符,一个 d目录名称必须少于248个字符。“在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

其他解决方案: https : //github.com/aspnet/EntityFramework/issues/1950#issuecomment-99164398

复制此修补版本的EntityFramework.psm1 。

我也有同样的问题 :(

我的解决方法是:

  1. 将entity framework降级到v6.1.1(至少新的NuGet GUI使这很容易)
  2. 在程序包管理器控制台上运行该命令(例如Add-Migration ... )。 它似乎适用于此版本
  3. 升级回Entity Framework v6.1.3

似乎是一个常见的问题,但显然难以回购?

启用 – 迁移错误#1950

建议您将您的问题详细信息添加到上面,希望能够快速解决。

根据yishaigalatzer关于EF bug#1950的评论,NuGet 3.0 RC2现已发布,应该可以解决这个问题。 只需从codeplex下载VSIX并安装即可。

这解决了我的问题。

我找到了一个临时解决方案:注释其所有“packages.config”只留下你想要工作的项目与迁移。

Team EntityFramework( https://github.com/aspnet/EntityFramework/issues/1950 )和NuGet( https://github.com/NuGet/Home/issues/528 )都知道这个问题,我们很快就会知道解决方案最终