'How to generate parameter based on another one in .net template
I have a .net template in my template.json configured like this
{
...
"tags": {
"language": "C#",
"type": "solution"
},
"sourceName": "MyCustomTemplate",
"sources": [
{
"rename": {
"Smth.WebSolution.sln": "Smth.MyCustomTemplate.sln"
}
}
],
"symbols": {
"MyCustomName": {
"type": "parameter",
"datatype": "string",
"description": "MyServiceName without a dash. Example = nameservice.",
"FileRename": "MyCustomName",
"isRequired": true,
"defaultValue": "WasMotRenamed"
}
}
}
I have "MyCustomTemplate" pattern in names of files like Smth.MyCustomTemplate.sln, also in the code and it works ok for me. Also as i understand it is possible to write MyCustomTemplate i a way like mycustomtemplate and it will replace the values in lower case.
What I also need to do is to have file names like smthmycustomtemplate For example i run a command
dotnet new shortName -o Test
and I need to get some files named like Smth.Test.sln and others like smthtest.txt
what i do now is dotnet new shortName -o Test --MyCustomName = smthtest
Is it possible to configure the template like that so the symbol could be made based on anothe value in json, or I have to set the file names in some way?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
