EF核心错误 - 没有找到项目。更改当前工作目录或使用--project选项 [英] EF Core Error - No project was found. Change the current working directory or use the --project option
问题描述
我正在使用 Visual Studio 2015 和dotnet核心,并尝试使用Sqlite 和本文档/教程开发一个 EF Core Code First项目,该文档/教程也使用Sqlite =
没有找到项目。更改当前工作目录或使用--project选项。
我甚至尝试使用 - 项目
选项如此。
> dotnet --projectC:\Shiva\EF\EFCFSqlite.Data.xprojef migrations添加InitialMigration
但是会出现以下错误。
未知选项:--project
.NET命令行工具(1.0.0-preview2-003131)
用法:dotnet [host-options] [command] [arguments] [common-options]
我注意到文档使用 .csproj
文件,而我的项目显示一个 xproj
文件。此外,文档还提到了一些关于不使用 project.json
的内容:(
这是我的 project.json
文件。
{
version:1.0.0- *
依赖关系:{
Microsoft.EntityFrameworkCore.Sqlite:1.1.1,
Microsoft.EntityFrameworkCore.Sqlite.Design:1.1 .1,
NETStandard.Library:1.6.1
},
工具:{
Microsoft.EntityFrameworkCore.Tools.DotNet:1.0 .0
},
框架:{
netstandard1.6:{
imports:dnxcore50
}
}
发生了什么变化?我们别无选择,只能安装Visual Studio 2017 从头开始是 project.json
,所有这些其他的东西不再荣幸吗?
似乎如果是这样,对我来说是一个巨大的变化:(
而不是:
t ools:{
Microsoft.EntityFrameworkCore.Tools.DotNet:1.0.0
},
尝试:
工具:{
Microsoft.EntityFrameworkCore.Tools。 DotNet:{
version:1.0.0-preview3-final
}},
I am using Visual Studio 2015 and dotnet core and trying to develop an EF Core Code First project using Sqlite and this documentation / tutorial, which also uses Sqlite => NET Core - New Database
When I try to add an initial migration from the command line ( I am CD-ed into the folder that my data model project is located in) by issuing the following command
dotnet ef migrations add InitialMigration
...I get the following Error.
No project was found. Change the current working directory or use the --project option.
I even tried using the --project
option like so.
> dotnet --project "C:\Shiva\EF\EFCFSqlite.Data.xproj" ef migrations add InitialMigration
but that gives the following error.
Unknown option: --project
.NET Command Line Tools (1.0.0-preview2-003131)
Usage: dotnet [host-options] [command] [arguments] [common-options]
I noticed that the documentation is using .csproj
file whereas my Project is showing a xproj
file. Also the docs mention something about not using project.json
anymore :(
Here's my project.json
file.
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.EntityFrameworkCore.Sqlite": "1.1.1",
"Microsoft.EntityFrameworkCore.Sqlite.Design": "1.1.1",
"NETStandard.Library": "1.6.1"
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet":"1.0.0"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}
What has changed? Do we have no choice but to Install Visual Studio 2017 and start from scratch?? Is project.json
and all this other stuff no longer honored?
Seems like a massive change to me if that's the case :(
Instead of:
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet":"1.0.0"
},
try:
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet": {
"version": "1.0.0-preview3-final"
}},
这篇关于EF核心错误 - 没有找到项目。更改当前工作目录或使用--project选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!