templating
templating copied to clipboard
Constraints & better ITEM templates support
Background
Goal of the epic: allow item templates implementation for Visual Studio and dotnet new. Implement a way to restrict templates to be run only under defined conditions using constraints and allow project context information to be able to create better C# item templates.
- [ ] #3829
- [x] #3107
- [ ] #4563
Justification
Customer impact
- Visual Studio supports item templates based on template.json
- currently it is not possible due to no way to restrict item templates to appear only in certain type of projects
- workaround exists for MAUI item templates, but cost of maintenance is quite high.
- Supporting item templates lays the ground to enabling 3rd party item templates in Visual Studio
- C# Item templates to become usable in also
dotnet new
- currently no use, as key project information is not available (TFM, namespace etc.)
- Visual Studio has support for project context information via host parameters
Engineering impact
- step towards deprecating old VS "template engine" after support of item templates
- Visual Studio elimiates workarounds required for MAUI item templates support and MSBuild properties via host parameters
Blocks
- https://github.com/dotnet/templating/issues/4607
Also fixes
- https://github.com/dotnet/templating/issues/3108