I'm new to MVC 4 and entity framework and when I run this command from the package manager console:
Enable-Migrations -ContextTypeName MyFirstMvcApp.Models.InventoryDbContext
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
I get the following error:
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\GitProjects\MyFirstMvcApp\trunk\packages\EntityFramework.6.0.0-alpha2\tools\EntityFramework.psm1:363 char:27
+ $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:\GitProjects\MyFirstMvcApp\trunk\packages\EntityFramework.6.0.0-alpha2\tools\EntityFramework.psm1:392 char:73
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path <<<< $toolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
You cannot call a method on a null-valued expression.
At D:\GitProjects\MyFirstMvcApp\trunk\packages\EntityFramework.6.0.0-alpha2\tools\EntityFramework.psm1:393 char:50
+ $dispatcher = $utilityAssembly.CreateInstance <<<< (
+ CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\GitProjects\MyFirstMvcApp\trunk\packages\EntityFramework.6.0.0-alpha2\tools\EntityFramework.psm1:426 char:19
+ (Join-Path <<<< $runner.ToolsPath EntityFramework.PowerShell.dll),
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
How do I fix this? Note that I am using Visual Studio 2010 Ultimate with SP1 and I have installed MVC4 in this link.
I had the same problem and solved it by changing the
Startup Project
.I have 5 project in the same solution and each time I
Right Click
andSet as startup
to a non ASPNET CORE project, I get this kind of error.Uninstalling Entity Framework didn't work for me.
It turned out that it was not
Visual Studio
orEntity Framemwork
casuing the problem, but it was the fact I was runningPowerShell 2
(onWindows 7
).Entity Framework
andVisual Studio
requirePowerShell 3
.Following the update and reboot, the issue was gone. Hopefully this will help a few people.
You can find PowerShell here -> https://www.microsoft.com/en-us/download/details.aspx?id=40855
In my case none of the above solutions worked, so I had a quick look in the packages.config file and to my surprise found two entries for Entity Framework
Note that they are different versions, not sure how this could actually happen. Anyway, once I removed the older one from the packages.config file i.e. ended up with just this one:
I could then Enable-Migrations with no issues.
As of version 6.3, the Entity Framework tooling supports the new SDK-style project format.
However, this issue can still happen when the project containing your migrations uses the new SDK-style format, while the startup project is using the classic csproj format.
To fix this, make both projects use the same csproj format.
I came across this issue while upgrading to EntityFramework "6.3.0" from "6.2.0". The issue and workaround can be found here EF 6.3.0 PMC commands throw
ParameterBindingValidationException
when Startup Project is a Web App.The problem arises when you have multiple projects and you set an ASP.NET project as the Startup project
Workaround suggested by the link:
Personal Solution:
Setting the Startup project to a non ASP.NET project fixed the issue in my case. Note that you will have to copy the connection strings to the relevant project's configuration file if you're using them.
Visual studio 2019: Uninstall-Package EntityFramework -Force
then
Install-Package EntityFramework -Pre -Version 6.2.0
something is up with v6.3.0