首页 > 解决方案 > .net 核心 + vue + coalescevue

问题描述

我试图使用这个包

https://github.com/IntelliTect/Coalesce.Vue.Template

在使用模板创建一个新的 Coalesce 项目的标题下,它说:

Run dotnet coalesce to trigger Coalesce's code generation.

但是,当我尝试这样做时,我收到了消息

dotnet : No executable found matching command "dotnet-coalesce"

我在文档中找不到任何进一步表明我遗漏任何东西的信息,因此我们将不胜感激

标签: vue.jsasp.net-core

解决方案


您应该dotnet coalesceweb 项目的根目录中运行。

假设我添加了一个新的 EF 实体,例如(我使用 newproject 作为项目名称只是为了测试):

namespace newproject.Data.Models
{
    public class Person
    {
        public int PersonId { get; set; }
        public string Name { get; set; }
        public DateTimeOffset? BirthDate { get; set; }
    }
}

在数据项目中使用Run dotnet ef migrationsadd Init(Init 可以是任何名称)来创建初始数据库迁移:

PS D:\nanyu\newproject\newproject.Data> dotnet ef migrations add Init

接下来dotnet coalesce在 web 项目的根目录中运行:

PS D:\nanyu\newproject\newproject.Data> cd D:\nanyu\newproject\newproject.Web
PS D:\nanyu\newproject\newproject.Web> dotnet coalesce

Coalesce 的代码生成将开始生成: 在此处输入图像描述 您将在 web 应用程序中找到相关的生成文件。


推荐阅读