一、文件夹\项目结构
1.1、文件夹
net6.0:针对.net 6.0 项目模板
net6.0pack:针对net6.0打包
1.2、项目结构
Web\WebApi多项目、各层项目、单元测试项目
目标:制作Web\WebApi两个项目模板
二、模板参数
2.1、template\net6.0\.template.config\template.json
{
"$schema": "http://json.schemastore.org/template",
"author": "yinyunpan",
"classifications": [ "Web", "WebApi" ],
"name": "项目模板案例",
"identity": "sample.template",
"shortName": "st",
"tags": {
"language": "C#",
//解决方案,与HostIdentifier用法生成解决方案文件名呼应
"type": "solution"
},
"sourceName": "sampletemplate",
"preferNameDirectory": false,
//重新生成项目guid,对应template.sln中项目guid
"guids": [
"5A6E6B9F-F8FA-4152-95B4-860F8CCAE3C3",
"30B12CFC-11E1-4E1C-B484-F708CEBD080A",
"810CD02B-0E13-4123-A84F-FBD4F4F1CD3A",
"3D2A540B-E773-44FA-82CF-14F3393D41B2",
"F4C1EFA8-824C-4985-A50D-BD1171ED1CFC",
"41C74675-6234-41F2-9B8A-4D06159D2A81",
"5EAD3BC3-554B-4058-9A9D-A91DF5F2DE1C",
"8A522BE9-0EE5-4C54-861B-394452A6744E",
"F075845E-43F4-466D-B731-904782BD9047"
],
"symbols": {
/**
template.sln文件有用host,排除项目文件引用
modifiers-condition,排除文件夹+文件
**/
"host": {
"type": "parameter",
"datatype": "choice",
"choices": [
{
"choice": "web",
"description": "后台"
},
{
"choice": "webapi",
"description": "接口"
}
],
"defaultValue": "web",
"description": "项目类型",
"displayName": "项目类型",
"isRequired": true
},
"web": {
"type": "computed",
"value": "(host == \"web\")"
},
"webapi": {
"type": "computed",
"value": "(host == \"webapi\")"
},
//应用的环境变量
"appUK": {
"type": "parameter",
"datatype": "string",
"description": "应用标识",
"displayName": "应用标识",
"isRequired": true,
"replaces": "wutong.netcore.sampletemplate"
},
"kestrelHttpPort": {
"type": "parameter",
"datatype": "integer",
"descripti