templating
templating copied to clipboard
[Epic] Components
Audience: authors (advanced)
Background
Allow custom extensibility scenarios for the templates.
The template engine already considers extensibility by using components. Component is a class implementing IIdentifiedComponent
interface. Template engine is managing components in ComponentManager
class.
At the moment the only way to install additional components is from code (adding components via ITemplateEngineHost
or adding components via IEngineEnvironmentSettings.ComponentManager
.
To allow extensibility scenario:
- the way of adding and managing additional assemblies with components should be implemented. The initial (currently disabled) implementation is available in
Scanner.ScanForComponents
method. Detected components are not saved to settings. - installing additional assemblies should be surfaced via command available in
dotnet new
.
Already defined components suitable for extensibility for template authoring:
- generators (
IGenerator
) - macros (generated symbols) in runnable projects generator (
IMacro
and its derived classes) - constraints (
ITemplateConstraintFactory
) - post actions (
IPostActionProcessor
Missing parts:
- acquisition/distribution workflow for components assemblies/packages
- managing the component assemblies versions (different templates may require the same component of different version)
- documentation
Justification
- give advanced authors more customization beyond standard features of template engine
Related issues:
- [x] Components issues #2727
- [ ] Move
IPostActionProcessor
component to Abstractions https://github.com/dotnet/templating/issues/3225 - [x] https://github.com/dotnet/templating/issues/2723
We would like to fetch a json file from a web service based on the parameter that is provided with dotnet new
.
Ready thorugh the issues, this could be a way of doing it. Is there any progress on this? As we would need a customer PostAction
as i believe?
Can we get an example of doing post actions, implementing IPostActionProcessor. Still seems like its not possible
Unfortunately we still don't have a timeframe for this feature, hence implementing custom post actions is not possible. Having more feedback on why the feature is important for you may help to prioritize it for the further releases.