【问题标题】:Startup project 'xxx' targets framework '.NETStandard'启动项目“xxx”以框架“.NETStandard”为目标
【发布时间】:2020-05-05 13:38:16
【问题描述】:

我正在尝试在 github 中为这个项目进行 Entity Framework Core 迁移 - https://github.com/johnph/simple-transaction#WebApi-Endpoints

但是如下图所示。我还将进行 EF 迁移的相同项目设置为“启动项目”。我试图搜索这个错误,但还没有结果。

我已经删除了现有的项目引用dll,重新编译并重新添加了引用。我还重新安装了 Entity Framework Core 和其他一些 Nuget 包。最后,我可以毫无错误地清理和重建整个解决方案。

我唯一不能让它工作的是创建数据库的 EF 代码优先迁移。

【问题讨论】:

    标签: c# asp.net-core asp.net-web-api entity-framework-core


    【解决方案1】:

    只需将您的 Transaction.WebApi 设置为启动项目,然后在包管理器控制台中选择 Transaction.Framework 以运行 add-migration

    【讨论】:

    • 谢谢。在我运行Add migration 之后,另一个错误显示No DbContext was found in assembly 'Transaction.Framework'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
    • 对了,你知道连接字符串在哪里吗?我在 appsettings.json 中看不到任何内容。自己手动添加?
    • 你必须去那里:\simple-transaction\src\Services\Transaction 并打开 appsettings.json 最后添加你的连接字符串
    猜你喜欢
    • 1970-01-01
    • 2021-05-22
    • 2018-12-03
    • 2011-04-05
    • 1970-01-01
    • 2020-10-23
    • 2016-11-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多