问题描述
仅当解决方案具有多个引用 EntityFramework 的项目时,才会出现下面粘贴的错误.运行Enable-Migrations"或Add-Migration"时,我收到以下错误:
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 : 提供的值无效,或者属性是只读.更改值,然后重试.在D:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:757字符:13+ $info = 新对象 System.AppDomainSetup -Property @{+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidData: (:) [New-Object],异常+ FullyQualifiedErrorId : SetValueException,Microsoft.PowerShell.Commands.NewObjectCommand在此对象上找不到属性PrivateBinPath".验证该属性存在并且可以设置.在D:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:772字符:9+ $info.PrivateBinPath += ';lib et45'+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId:PropertyNotFound 异常调用LoadFrom",参数为1":指定的路径、文件名或两者都太长了.全限定文件名必须小于 260字符,并且目录名称必须少于 248 个字符."在D:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:780字符:5+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsP ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : PathTooLongException 您不能在空值表达式上调用方法.在D:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:781字符:5+ $dispatcher = $utilityAssembly.CreateInstance(+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId : InvokeMethodOnNull 异常调用CreateInstanceFrom",参数为8":指定的路径,文件名称,或两者都太长.完全限定的文件名必须小于超过 260 个字符,并且目录名必须小于 248字符."在D:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:809字符:5+ $domain.CreateInstanceFrom(+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : PathTooLongException
New-Object : The value supplied is not valid, or the property is read-only. Change the value, and then try again. At D:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.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:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:772 char:9 + $info.PrivateBinPath += ';lib et45' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 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:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.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:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.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:ProjetosMonitoramentopackagesEntityFramework.6.1.3 oolsEntityFramework.psm1:809 char:5 + $domain.CreateInstanceFrom( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : PathTooLongException
EntityFramework 6.1.1 的输出:
Output with EntityFramework 6.1.1:
使用1"个参数调用LoadFrom"的异常:指定的路径、文件名或两者都太长.完全限定的文件名必须少于 260 个字符,并且目录名必须少于超过 248 个字符."在 C:UsersHudsonDocumentsVisual Studio2015ProjectsWpfApplication4packagesEntityFramework.6.1.1 oolsEntityFramework.psm1:780字符:5+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsP ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : PathTooLongException 您不能在空值表达式上调用方法.在C:UsersHudsonDocumentsVisual Studio2015ProjectsWpfApplication4packagesEntityFramework.6.1.1 oolsEntityFramework.psm1:781字符:5+ $dispatcher = $utilityAssembly.CreateInstance(+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId : InvokeMethodOnNull 异常调用CreateInstanceFrom",参数为8":指定的路径,文件名称,或两者都太长.完全限定的文件名必须小于超过 260 个字符,并且目录名必须小于 248字符."在 C:UsersHudsonDocumentsVisual Studio2015ProjectsWpfApplication4packagesEntityFramework.6.1.1 oolsEntityFramework.psm1:809字符:5+ $domain.CreateInstanceFrom(+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : PathTooLongException
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:UsersHudsonDocumentsVisual Studio 2015ProjectsWpfApplication4packagesEntityFramework.6.1.1 oolsEntityFramework.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:UsersHudsonDocumentsVisual Studio 2015ProjectsWpfApplication4packagesEntityFramework.6.1.1 oolsEntityFramework.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:UsersHudsonDocumentsVisual Studio 2015ProjectsWpfApplication4packagesEntityFramework.6.1.1 oolsEntityFramework.psm1:809 char:5 + $domain.CreateInstanceFrom( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : PathTooLongException
推荐答案
其他解决方案:https://github.com/aspnet/EntityFramework/issues/1950#issuecomment-99164398
复制 此修补版本的 EntityFramework.psm1.
这篇关于Visual Studio 2015 RC 实体框架 6.1.3 迁移错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!