本文介绍了Visual Studio 2015 RC 实体框架 6.1.3 迁移错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅当解决方案具有多个引用 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.3oolsEntityFramework.psm1:757字符:13+ $info = 新对象 System.AppDomainSetup -Property @{+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidData: (:) [New-Object],异常+ FullyQualifiedErrorId : SetValueException,Microsoft.PowerShell.Commands.NewObjectCommand在此对象上找不到属性PrivateBinPath".验证该属性存在并且可以设置.在D:ProjetosMonitoramentopackagesEntityFramework.6.1.3oolsEntityFramework.psm1:772字符:9+ $info.PrivateBinPath += ';libet45'+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId:PropertyNotFound 异常调用LoadFrom",参数为1":指定的路径、文件名或两者都太长了.全限定文件名必须小于 260字符,并且目录名称必须少于 248 个字符."在D:ProjetosMonitoramentopackagesEntityFramework.6.1.3oolsEntityFramework.psm1:780字符:5+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsP ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : PathTooLongException 您不能在空值表达式上调用方法.在D:ProjetosMonitoramentopackagesEntityFramework.6.1.3oolsEntityFramework.psm1:781字符:5+ $dispatcher = $utilityAssembly.CreateInstance(+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId : InvokeMethodOnNull 异常调用CreateInstanceFrom",参数为8":指定的路径,文件名称,或两者都太长.完全限定的文件名必须小于超过 260 个字符,并且目录名必须小于 248字符."在D:ProjetosMonitoramentopackagesEntityFramework.6.1.3oolsEntityFramework.psm1:809字符: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.1oolsEntityFramework.psm1:780字符:5+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsP ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : PathTooLongException 您不能在空值表达式上调用方法.在C:UsersHudsonDocumentsVisual Studio2015ProjectsWpfApplication4packagesEntityFramework.6.1.1oolsEntityFramework.psm1:781字符:5+ $dispatcher = $utilityAssembly.CreateInstance(+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId : InvokeMethodOnNull 异常调用CreateInstanceFrom",参数为8":指定的路径,文件名称,或两者都太长.完全限定的文件名必须小于超过 260 个字符,并且目录名必须小于 248字符."在 C:UsersHudsonDocumentsVisual Studio2015ProjectsWpfApplication4packagesEntityFramework.6.1.1oolsEntityFramework.psm1:809字符: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 迁移错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-20 20:52