bolt19
bolt19

Reputation: 2053

Unable to add migration using Entity Framework and Visual Studio 2015

I have just installed Visual Studio 2015 Express edition, upgrading from Visual Studio 2013 Express. I am now unable to update a database I have been using in one of my projects using code-first migrations. All I have changed is removing the [Required] data annotation from a property called "field" in a class called "Prospect".

I have tried upgrading Entity Framework to 6.2.3 and completely reinstalling it but neither has worked, I am currently using version 6.1.2.

In Visual Studio 2013 the 'Add-Migration' command worked fine but when trying to add the migration in visual studio 2015 the following error is produced in the package management console;

PM> Add-Migration remove_required_field_from_prospect Unable to find

type [NuGet.VisualStudio.IVsPackageInstallerServices]. Make sure that the assembly that contains this type is loaded. At 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 You cannot call a method on a null-valued expression. At 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 : Cannot bind argument to parameter 'Path' because it is null. At D:\Repos\PDintel\PDintel\packages\EntityFramework.6.1.2\tools\EntityFramework.psm1:713 char:28 + $toolsPath = Join-Path $installPath tools + ~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand Join-Path : Cannot bind argument to parameter 'Path' because it is null. At 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 You cannot call a method on a null-valued expression. At 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 : Cannot bind argument to parameter 'Path' because it is null. At 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

If you need any more info please ask!

Any help would be greatly appreciated!

UPDATE This error seems to appear whenever I try and do anything using the Entity Framework, even 'Enable-Migrations' triggers it.

Upvotes: 1

Views: 3220

Answers (2)

GrimmA
GrimmA

Reputation: 11

If you have a .nuget folder in your solution check the version of the nuget.exe Version there... A update of that was the fix in my case.

Upvotes: 0

bolt19
bolt19

Reputation: 2053

Turns out this was a bug with the Package Management Console and has now been fixed!

Upvotes: 0

Related Questions