Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluding a File from Renaming in Template Generation #7871

Open
bohems opened this issue Apr 16, 2024 · 1 comment
Open

Excluding a File from Renaming in Template Generation #7871

bohems opened this issue Apr 16, 2024 · 1 comment

Comments

@bohems
Copy link

bohems commented Apr 16, 2024

Is your feature request related to a problem? Please describe.

I'd like to express my immense gratitude to the contributors of dotnet/templating! Your tool has been incredibly useful to me, and I've been enjoying using it. However, I've encountered a challenge that I could use some help with.

I've created this template, which can be found here:
https://github.com/bohems/service-template

Subsequently, I generate a template using the following command:
dotnet new service -n ServiceName -F net8.0

This results in all instances of 'Template' being replaced with 'ServiceName' which is exactly what I want.

However, within this repository, there's a specific file I'm concerned about:
https://github.com/bohems/service-template/blob/main/Template/Tools/Template.DbSeeder/seed-settings.json

Within this file, there's a key named "outputTemplate", and unfortunately, it gets renamed too, which is not what I intend:

{
  "Serilog": {
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "formatter": "",
          // In this key, the word "Template" gets renamed, but I do not want this to occur.
          "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"
        }
      }
    ]
  },
  "ConnectionStrings": {
    "DefaultConnection": "",
  }
}

Could you provide guidance on how to address this issue, perhaps a way to exclude this file from being renamed, or a workaround to prevent renaming of that particular key?

Describe the solution you'd like.

Excluding a File from Renaming in Template Generation

Additional context

No response

@egvijayanand
Copy link
Contributor

If there's no other processing in this file, configure it to the copyOnly section in the template.json so that the templating engine won't touch it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants