calculated parameters
See original GitHub issuereading the https://blogs.msdn.microsoft.com/dotnet/2017/04/02/how-to-create-your-own-templates-for-dotnet-new/ I read this:
The expression used in the condition here, (EnableContentPage), is very basic but, you can create more complex conditions using operators such as &&,||,!,<,>=,etc. For more info see https://aka.ms/dotnetnew-template-config.
Looks like that I can create a complex condition inside the template, but since sometimes the expressions can be complicated and must replicated in more places in the template files, I would like to know if is possibile to move the definition and evalution of the expression outside the files itself in a single place. I looked to the documentation and I don’t understand if is possible: the more simple idea I have is to create some kind of parameter as a calculated field based on other paramters and conditions, and use this directly in the template files.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
I’m not sure if this is what you are looking for so let me know if it’s not.
If you need to use a condition in several places I believe that a
computed
symbol is what you need. For example see howOrganizationalAuth
is defined in here.After creating that computed symbol you can use that in your
if
statements. So you can doExample here
Instead of
I created https://github.com/dotnet/dotnet-template-samples/issues/19 to track creating a sample for this.