0

I have a .net core console app in VS19 for a browser extension.

The project includes a couple of .manifest and .reg files which have different values for each target configuration (Dev, Test, Prod).

I'd like to have one template file for each .manifest, .reg file having tokens instead of those values and replace them with the real values (stored e.g. in appsettings.json) after building the solution (keeping my template file untouched).

What is the simples way to achieve this?

Juergen Riemer
  • 1,393
  • 2
  • 13
  • 29
  • The **simplest** way would be to have not one template but 3 sources for your build targets and use a target configuration post-build task to add the one for the specific environment. Of course the downside is to keep 3 sources up to date. – Filburt Apr 19 '20 at 07:24
  • Well, this is my current situation but as you mentioned it is a bit cumbersome for I already have 9 files and an additional target configuration on the brink. – Juergen Riemer Apr 19 '20 at 07:31
  • There's [T4 templates](https://learn.microsoft.com/en-us/visualstudio/modeling/code-generation-in-a-build-process?view=vs-2019) and [How to run them on build](https://stackoverflow.com/q/1646580/205233) but I'm pretty sure this is way beyond *simple*. – Filburt Apr 19 '20 at 07:37
  • Thanks, I hope there is sg simplier :) – Juergen Riemer Apr 19 '20 at 11:47

0 Answers0