EF Core 错误 - 未找到项目.更改当前工作目录或使用 --project 选项 [英] EF Core Error - No project was found. Change the current working directory or use the --project option

本文介绍了EF Core 错误 - 未找到项目.更改当前工作目录或使用 --project 选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Visual Studio 2015 和 dotnet 核心,并尝试使用 Sqlite 开发 EF Core Code First 项目 和本文档/教程,它也使用 Sqlite =>

<块引用>

未找到任何项目.更改当前工作目录或使用 --project 选项.

我什至尝试过像这样使用 --project 选项.

>dotnet --project "C:ShivaEFEFCFSqlite.Data.xproj" ef 迁移添加 InitialMigration

但这会产生以下错误.

未知选项:--project.NET 命令行工具 (1.0.0-preview2-003131)用法:dotnet [host-options] [command] [arguments] [common-options]

我注意到文档使用的是 .csproj 文件,而我的项目显示的是 xproj 文件.文档还提到不再使用 project.json :(

这是我的 project.json 文件.

<代码>{"版本": "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":{进口":dnxcore50"}}

发生了什么变化?我们别无选择,只能安装 Visual Studio 2017 并从头开始?project.json 和所有其他东西不再受到尊重吗?

如果是这样的话,对我来说似乎是一个巨大的变化:(

解决方案

代替:

工具":{"Microsoft.EntityFrameworkCore.Tools.DotNet":"1.0.0"},

试试:

工具":{Microsoft.EntityFrameworkCore.Tools.DotNet":{版本":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:ShivaEFEFCFSqlite.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 Core 错误 - 未找到项目.更改当前工作目录或使用 --project 选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆