templating
                                
                                
                                
                                    templating copied to clipboard
                            
                            
                            
                        Add optional argument to dotnet new for adding .gitignore
Is your feature request related to a problem? Please describe.
Based off of Twitter thread for folks https://twitter.com/isaacrlevin/status/1571908208675147776
Describe the solution you'd like
Adding a new argument to dotnet new that will allow adding a .gitignore to the output of the command. For instance
dotnet new web --add-git
                                    
                                    
                                    
                                
First step would be to identify the templates that should have this option. Only some of them are in this repo. You can check the README on the dotnet/templating repo for a more up-to-date list of repos that own specific templates - I try to keep that up to date.  Then, for each project template that should have this option, you'd add a new symbol to the template.json - note that there are different templates for each supported language, so you'd need to replicate that symbol.
Once you have a symbol defined, you'd add a postAction that has a condition that checks the symbol you defined earlier. I'd suggest looking at the run script postAction. Once you've made the changes, you can test by running dotnet new install path/to/template/folder to install the templates in that folder, invoke them, then uninstall with dotnet new uninstall path/to/template/folder.
Got it, so there isn't a universal template that all the other templates inherit from? I was thinking at the same level the output argument, but you are saying it needs to be done at every template.
Correct - there's no inheritance here. Each template is an island.
Got it. So this change will need to be in a few different repos than. I will take a look
this is very much related to https://github.com/dotnet/templating/issues/3208 and https://github.com/dotnet/templating/issues/2771.
@vlada-shubina is there work being done in this space? I would hate to start the process of updating every template if there is a new process coming at some point.
No, unfortunately there is no definite timeline for those features at the moment.
@baronfel when I get to a point to test the templates, I assume I need to build them into a a nupack file from the repo the templates are in (for instance the aspnet repo)? Than build a new version of dotnet new than run the command you provided? The docs aren't super clear
We decided it falls in scope of https://github.com/dotnet/templating/issues/3208 or https://github.com/dotnet/templating/issues/2771, but there is no definite timeline on that yet.