无法使用Entity Framework和Visual Studio 2015添加迁移

问题描述 投票:1回答:2

我刚安装了Visual Studio 2015 Express版,从Visual Studio 2013 Express升级。我现在无法使用代码优先迁移更新我在我的一个项目中使用的数据库。我所做的就是从名为“Prospect”的类中的名为“field”的属性中删除[Required]数据注释。

我已经尝试将Entity Framework升级到6.2.3并完全重新安装但是两者都没有用,我目前正在使用版本6.1.2。

在Visual Studio 2013中,“添加 - 迁移”命令工作正常,但在尝试在Visual Studio 2015中添加迁移时,包管理控制台中会产生以下错误。

PM>添加迁移remove_required_field_from_prospect无法找到

输入[NuGet.VisualStudio.IVsPackageInstallerServices]。确保已加载包含此类型的程序集。在D:\ Repos \ PDintel \ PDintel \ packages \ EntityFramework.6.1.2 \ tools \ EntityFramework.psm1:1004 char:5 + $ packageInstallerServices = $ componentModel.GetService([NuGet.VisualStudio.I ... + ~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidOperation :( NuGet.VisualStu ... stallerServices:TypeName)[],RuntimeException + FullyQualifiedErrorId: TypeNotFound你不能在空值表达式上调用方法。在D:\ Repos \ PDintel \ PDintel \ packages \ EntityFramework.6.1.2 \ tools \ EntityFramework.psm1:1006 char:5 + $ vsPackage = $ packageInstallerServices.GetInstalledPackages( )|?{$ _.Id -eq ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidOperation :( :) [],RuntimeException + FullyQualifiedErrorId:InvokeMethodOnNull Join-Path:无法将参数绑定到参数'Path',因为它为null。在D:\ Repos \ PDintel \ PDintel \ packages \ EntityFramework.6.1.2 \ tools \ EntityFramework.psm1 :713 char:28 + $ toolsPath = Join-Path $ installPath工具+ ~~~~~~~~~~~~ + CategoryInfo:InvalidData :( :) [Join-Path],ParameterBindingValidationException + FullyQualifiedErrorId:ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand Join -Path:无法将参数绑定到参数'Path',因为它为null。在D:\ Repos \ PDintel \ PDintel \ packages \ EntityFramework.6.1.2 \ tools \ EntityFramework.psm1:780 char:74 + $ utilityAssembly = [System.Reflection.Assembly] :: LoadFrom((Join-Path $ ToolsP。 .. + ~~~~~~~ + CategoryInfo:InvalidData :( :) [Join-Path],ParameterBindingValidationException + FullyQualifiedErrorId:ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand您无法在空值表达式上调用方法。 D:\ Repos \ PDintel \ PDintel \ packages \ EntityFramework.6.1.2 \ tools \ EntityFramework.psm1:781 char:5 + $ dispatcher = $ utilityAssembly.CreateInstance(+ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidOperation :( :) [],RuntimeException + FullyQualifiedErrorId:InvokeMethodOnNull Join -Path:无法将参数绑定到参数'Path',因为它为null。在D:\ Repos \ PDintel \ PDintel \ packages \ EntityFramework.6.1.2 \ tools \ EntityFramework.psm1:810 char:20 +(Join-Path $ runner.ToolsPath EntityFramework.PowerShell.dll),+ ~~~~~~~~~~~~~~~~ 〜+ CategoryInfo:InvalidData:(:) [Join-Path],ParameterBindingValidationException + FullyQualifiedErrorId:ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

如果您需要更多信息,请询问!

任何帮助将不胜感激!

更新每当我尝试使用实体框架执行任何操作时,似乎都会出现此错误,甚至“启用 - 迁移”也会触发它。

c# entity-framework powershell code-first
2个回答
0
投票

事实证明这是包管理控制台的一个错误,现在已经修复了!


0
投票

如果您的解决方案中有.nuget文件夹,请检查nuget.exe版本的版本...在我的情况下,更新是修复。

© www.soinside.com 2019 - 2024. All rights reserved.