Adding Microsoft.EntityFrameworkCore.Tools to a ASP.NET Core project

asp.net-core entity-framework-core

Question

I am creating a new ASP.NET Core project using dotnet 4.5.2 and am trying to add a reference to Microsoft.EntityFrameworkCore.Tools. In my project.json file I have these listed under dependencies:

 "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
 "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"

Looking under References, they appear to be successfully loaded. I then added this under tools in project.json:

"Microsoft.EntityFrameworkCore.Tools": {
  "imports": [ "portable-net451+win8" ],
  "version": "1.0.0-preview2-final"
}

After I added that, when I build the solution I get this build error:

Could not find a part of the path 'C:\Users\(my user name)\.nuget\packages\.tools\Microsoft.EntityFrameworkCore.Tools'

I get the same error if I remove the imports line. What am I doing wrong here?

1
3
6/28/2016 2:59:37 PM

Accepted Answer

Just ran into the same issue. I fixed the issue by installing the tools package again in the package manager console:

Install-Package Microsoft.EntityFrameworkCore.Tools –Pre

Before reinstalling the package was actually missing in the .nuget\packages.tools folder, after reinstalling it was there.

I followed the https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html tutorial, but I think I installed the package in the wrong order or initially forgot to reference the EF.tools package in the "tools" section of the project json.

7
8/2/2016 8:52:05 AM

Popular Answer

I had this same problem and just solved using the examples from the EF Core setup guide from Microsoft, checking their GitHub code as well, I found this to work for the project.json.

I had to remove the imports from the "frameworks" property, which means no Application Insights for now. Once I did this and built, the folder appeared in the tools folder. Sorry I'm not good at posting code here but here are the important parts, ... elipses used to trim the post of my other things:

"dependencies": {
...
"Microsoft.EntityFrameworkCore": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": {
  "version": "1.0.0-preview2-final",
  "type": "build"
}  ...},

"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},

"frameworks": {
"netcoreapp1.0": {

}...


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow