How to use user input project name in template.json
See original GitHub issueHow to use user input project name in template.json?
I wanna rename some variables by project name, how can I get project name?
I’ve tried to use (name)
,but it did not work.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Reference for template.json
To specify the template type, use the tag type . Supported types are: project , item , solution . no. shortName, A name...
Read more >Custom templates for dotnet new - .NET CLI
You can quickly create a template from an existing project just by adding a ./.template.config/template.json configuration file to the project.
Read more >how to update File Name in Visual Studio Project Template ...
I am trying to create a Visual Studio 2022 Project Template. ... I am not able to use the user input value to...
Read more >How to Create Your .NET Project Template
Let's take a look. Assigning a custom application name. Using the dotnet new command with the built-in templates, you can specify the name...
Read more >User Variables - Templates | Packer
User variables allow your templates to be further configured with variables from the command-line, environment variables, or files.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah ok, for something like this, you should use a “derived” type symbol. #1066 has a good explanation of how they work. For your specific situation, something like this should work:
A simpler method that might work (depending on your situation) is to have the literal “Service.” in your template content. For example if your sourceName = “Company.Application1”, in the content you could have something like this:
When the file is processed,
Company.Application1
will be replaced by the value of the name parameter, butService.
will stay as is.Is there a way to use -o input from the user to replace something?