templating icon indicating copy to clipboard operation
templating copied to clipboard

Constraints & better ITEM templates support

Open donJoseLuis opened this issue 4 years ago • 0 comments

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

  1. 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.
  1. Supporting item templates lays the ground to enabling 3rd party item templates in Visual Studio
  2. 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

  1. step towards deprecating old VS "template engine" after support of item templates
  2. 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

donJoseLuis avatar Jan 21 '22 16:01 donJoseLuis