dotnet / templating

This repo contains the Template Engine which is used by dotnet new
https://docs.microsoft.com/dotnet/
MIT License
1.59k stars 363 forks source link

Add properties/items to project file when generating template #5812

Open vlada-shubina opened 1 year ago

vlada-shubina commented 1 year ago

At the moment the template engine is not capable of modifying any existing files, including project files. This is an issue for certain class of templates, requiring update of project files in addition to adding new files.

As concrete case, this is required for F# item templates. When adding item template to F# project, it has to be added to project file as well:

  <ItemGroup>
    <Compile Include="MyNewFile.fs" />
  </ItemGroup>

Therefore, to support F# item templates, the engine should be extended to allow project file modification.

Suggested basic F# item templates at the moment:

JanKrivanek commented 1 year ago

Will need similar approach as: https://github.com/dotnet/templating/issues/4492