I am creating my first template for a .NET solution. For the most part it works, but I have a string "MyService" at some places in the Program.cs that I would like to replace with "NewService" when I create a solution with this template.
{
"$schema": "http://json.schemastore.org/template",
"author": "ich",
"classifications": [ "Solution", "Service" ],
"identity": "Service.Template",
"name": "Service Template",
"shortName": "my-service",
"sourceName": "Services.MyService",
"preferNameDirectory": true,
"placeholderFilename": ".keep",
"symbols": {
"Company": {
"type": "parameter",
"datatype": "string",
"defaultValue": "not",
"description": "not saying"
},
"ServiceName": {
"type": "parameter",
"datatype": "string",
"defaultValue": "MyService",
"description": "Kurzname des Service"
}
},
"sources": [
{
"modifiers": [
{
"condition": "true",
"replaces": [
{
"replace": "MyService",
"with": "{ServiceName}",
"files": "**/*.cs"
}
]
}
]
}
],
"tags": {
"language": "C#",
"type": "solution"
}
}
After installing the template, I use it with this command:
dotnet new my-service -n TestService --ServiceName=NewService
At the places I have to replace a string, I tried using:
c.SwaggerEndpoint("v1/swagger.json", "MyService Service v1");
c.SwaggerEndpoint("v1/swagger.json", "{ServiceName} Service v1");
c.SwaggerEndpoint("v1/swagger.json", "{{ServiceName}} Service v1");
c.SwaggerEndpoint("v1/swagger.json", "__ServiceName__ Service v1");
What am I doing wrong?
Thank you for your help.
