NeVeSpl / NTypewriter

File/code generator using Scriban text templates populated with C# code metadata from Roslyn API.
https://nevespl.github.io/NTypewriter/
MIT License
126 stars 25 forks source link

Can't have multiple template files in a project? #11

Closed gregveres closed 3 years ago

gregveres commented 3 years ago

I am trying to have two templates in a project like this:

Scripts/api
+- Enums
  +- _Enums.nt
  +- <all the .ts files representing my enums go here>
+- Interfaces
  +- _Interfaces.nt
  +- <all the .ts files representing my interfaces go here>

What I am finding is that as soon as I render the _Interfaces.nt template, it deletes the _Enums.nt file.

I would really like to have three templates, another for services that lives in a similar structure but called _Services.nt.

Is it not possible to have multiple .nt files?

NeVeSpl commented 3 years ago

It is possible. But I guess that you have created a second template file by ctrl+c and ctrl+v, and now both have the same tracking id. Just delete one of ids that can be found in .nt file -> Properties->Custom Tool Namespace. A new id will be generated on the first render.

It is of course a bug and will be fixed in a future release.

gregveres commented 3 years ago

Yes that is exactly what I did. Ok, I will go split them out into separate files then by changing the tracking Id or just creating a new file and copying and pasting the contents.

Thanks for the info (and tool)

gregveres commented 3 years ago

Just coming back to verify that everything is working perfectly now that I have created new template files rather than copying and pasting an existing template file.

I now have three template files in the project and they are all updating properly.