Allow template engine host to add/customize parameters before template instantiation
At the moment there is a kind of circular dependency for CLI template engine host:
- CLI host needs to know output directory to setup the host default parameters
- host is the key object to create engine environment settings and start parsing
As the result, output directory has to be parsed additionally before main parsing logic even starts, though it is not yet known if the flow is instantiation or anything else which doesn't need output directory.
I think the only way to do it properly is do a feature in template engine edge instead, allowing to send parameters sent to template instantiation (name, output, other template parameters) to host first to allow host to populate additional parameters before template instantiation is started. At that time output directory is already parsed and known.
Originally posted by @vlada-shubina in https://github.com/dotnet/templating/pull/4103#discussion_r752043867
This needs to be done after CLI is moved to sdk repo - it makes it much easier to fix.