Files
Yi.Framework/Yi.Doc.Md/01.框架快速开始教程/05.脚手架使用.md
2024-02-18 09:35:35 +08:00

34 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 简介
上节说到真正关注的代码其实只用在src中
![image.png](/prod-api/file/7f52e9a7-6b6d-cc80-64f6-3a10031e9214/true)
当我们要新建一个项目或者模块的时候,并不想取这个`Yi.Abp`的名字我们可以使用dotnet的脚手架进行模板的生成
**环境**只需要dotnet sdk即可
## 步骤
![image.png](/prod-api/file/2a8d18c4-4899-433d-3553-3a10032e9645/true)
在模板文件目录上,有一个`.template.config`文件夹,就是通过这个进行控制模板的生成及替换
进入该目录使用cmd执行以以下命令
``` shell
dotnet new install . --force
```
![image.png](/prod-api/file/0a92e464-13af-ef93-77b9-3a10032fe20c/true)
出现 `已安装以下模板` 及代表安装完成
>我们只需要安装一次即可,如果模板文件发生变化,我们生成出来的文件也是一样会变化的
当模板安装完成,接下来我们可以选择一个自己想要的空白文件夹,输入命令:
``` shell
dotnet new yi --name=Acme.BookStore
#Acme.BookStore可以替换成你想要生成的名称即可
```
![image.png](/prod-api/file/55536e5a-ef47-1593-3701-3a100333df31/true)
最后查看目录:
![image.png](/prod-api/file/20286d62-a9d1-6ab0-7fc0-3a1003348554/true)
这个便是我们想要的结果了