I am attempting to create a custom Visual Studio project template and I have a template.json. What I am trying to achieve is to hide / disable the DoStuff
parameter from the Visual Studio create project wizard if another parameter (in my case, ProjectType
) was equal to something specific. It would essentially be something like the Docker OS
parameter from the default Visual Studio API template.
As you can see, by default the dropdown (in my case, it would be a checkbox) is hidden / disabled, but if I check Enable Docker
, it can be selected.
Below is my current template.json
file which I can't seem to get right to have this feature.
{
"$schema": "http://json.schemastore.org/template",
"symbols": {
"ProjectType": {
"type": "parameter",
"datatype": "choice",
"choices": [
{
"choice": "Console"
},
{
"choice": "API"
}
],
"defaultValue": "API",
"description": "The type of the project you are building."
},
"DoStuff": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
// hide if ProjectType == API
}
}
}
I tried to combine it with ide.host.json
to achieve this, but it's not working at all.
{
"$schema": "https://json.schemastore.org/ide.host.json",
"defaultSymbolVisibility": true,
"order": 2,
"icon": "icon.png",
"symbolInfo": [
{
"id": "DoStuff",
"isVisible": "(ProjectType == \"API\")"
}
]
}