question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet new gitignore should synch up with public template

See original GitHub issue

Summary of issue

The dotnet new gitignore command saves a workflow step when scaffolding projects and really happy to see dotnet new --install Microsoft.DotNet.Common.ItemTemplates::6.0.100 and those workflow improvements.

Drift between gitignore templates or subtractions in the templates might introduce some security issues if secrets are checked in incorrectly for a new project or while doing a project refresh.

As an example, patches from issues updated in a Feb, 2021 template here are not in a June, 2021 template on GitHub.

Repro

This is the first template which comes up in search results for Visual Studio gitignore when scaffolding a new project.
https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

It is different than the template generated using dotnet new gitignore from the 6.0.100 cli. https://github.com/dotnet/templating/blob/main/template_feed/Microsoft.DotNet.Common.ItemTemplates/content/Gitignore/.gitignore

  • The template here is missing nuget.config comment placeholder. There’s specific scenarios where nuget.config should or shouldn’t be committed in 2021 and a comment indicating so rather than just removing nuget.config could be shown. See https://github.com/NuGet/Home/issues/10566 and https://github.com/github/gitignore/pull/3706 - I don’t know if this situation is resolved but it’s impacting in terms of public/private feed credentials. Also don’t know if it’s responsibility of this repo’s maintainers to maintain the other repo’s gitignore.
  • The templating currently excludes .tye files here but not in Github. Would be nice to have a unique identifier (not a url) and some more description about what .tye files are in the .gitignore to look up more info on what tye is and why someone would be ignoring the files from a binary, transitory or security perspective. In any case these should be in synch.

Suggestions

  • Suggest some background task to synch this repo from GitHub gitignore, as two repos code / PRs diverge and improvements happen.

  • Source the template from github directly, with some option to download / refresh it for offline consumers.

  • The template currently provided with dotnet new includes some additional exclusions for mac settings and things that are not really mac settings. Add these to the Github template if required, though are they really needed or is the workflow of a unique developer that could be added to personal/global gitignore? When I see common .gitignore entries for mac, the gitignore list is a lot smaller and usually just include .DS_Store and thumbnails. and config.make, tarballs, etc.

  • The mac ignores look a little broad (eg. *.tar.gz is not mac-specific, it’s a binary archive format) and what is “Mac bundle stuff”. The comments could be more specific and professional if introduced via this repo’s contributions. These will be in every dotnet project.

As a templating library, could enforce further rules and guidance for .gitignore comments, security and ensure standardization in the gitignore for dotnet.


Files to sync:

File Source Target
.gitignore github/gitignore dotnet/sdk
template.json dotnet/templating SchemaStore/schemastore - bi-directional
docs dotnet/templating dotnet/templating/wiki

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
baronfelcommented, Apr 27, 2022

We don’t have plans to do the sync mechanism for the .NET 7 timeframe currently, but we are open to periodic syncs. There’s one happening over at https://github.com/dotnet/templating/pull/4598 right now, if you’d like to review and ensure it does what you’d expect it to!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Drop a gitignore file as part of project/sln templates #823
My workflow for creating a new project with dotnet new is generally something like this: mkdir MyNewProject; cd MyNewProject; dotnet new ...
Read more >
dotnet new gitignore not creating .gitignore file
gitignore in NuGet Package Manager Console, but I find no .gitignore shown in the Visual Studio and the root folder. > dotnet new...
Read more >
Easy to create .gitignore for the dotnet developers
I like to have a tidy repository without /obj/* and /bin/* objects, or other IDE specific things included. Storing such files is both...
Read more >
Create a gitignore file with dotnet cli
This command will create a perfect .gitignore in your folder with a lot of settings to ignore unnecessary files, not only for Visual...
Read more >
dotnet new gitignore (#207) - YouTube
A .gitnore file allows you to exclude specific files and folders from source control. Use the dotnet new gitignore command to quickly add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found