templating icon indicating copy to clipboard operation
templating copied to clipboard

[Epic] Common template features for .NET templates (sln, editorconfig)

Open mikadumont opened this issue 4 years ago • 5 comments

Copying Kathleen's comments from below:

The template team maintains the .NET standard .editorconfig. Logically this is the same one you get with dotnet new .editorconfig. Templates will not include .editorconfig. When the user creates a project, they have the option to use --sln to create the project in a solution (a different feature that this assumes, although it might be later). If this switch is used, a .editorconfig will be placed at the solution level. If the user either creates the new project with a parent directory that has a .sln file, or they use the --sln switch, no .editorconfig will be placed in the project file. Otherwise, it will be. This might be managed by a post action so template authors could skip it, but we think it is probably the best behavior for all project templates.

The part about -sln is probably not relevant. Therefore, it should be considered out of the scope of this issue.

mikadumont avatar May 25 '21 17:05 mikadumont

Can you share a bit more details what are you expecting here? Do you expect dotnet new editorconfig like https://github.com/dotnet/templating/issues/3195 suggests or you expect dotnet new console to include .editorconfig file?

DavidKarlas avatar May 25 '21 18:05 DavidKarlas

Both but my issue is with regards to dotnet new console to include .editorconfig file (.NET) template which has the prepopulated default .NET code style, formatting, and naming conventions: https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019#add-an-editorconfig-file-to-a-project

mikadumont avatar May 25 '21 18:05 mikadumont

@mikadumont @jmarolf and I chatted on this. It would be a nightmare to keep all the .editorconfig's consistent if we put them into every template, and then it would be a bad experience for users to wind up with multiple editor config's (per project) instead of one (per repo). That said, we love .editorconfig and want it in every repo :-) Thus, a new more complex feature!

A rough outline:

  • The template team maintains the .NET standard .editorconfig. Logically this is the same one you get with dotnet new .editorconfig. Templates will not include .editorconfig.
  • When the user creates a project, they have the option to use --sln to create the project in a solution (a different feature that this assumes, although it might be later). If this switch is used, a .editorconfig will be placed at the solution level.
  • If the user either creates the new project with a parent directory that has a .sln file, or they use the --sln switch, no .editorconfig will be placed in the project file. Otherwise, it will be.
  • This might be managed by a post action so template authors could skip it, but we think it is probably the best behavior for all project templates.

KathleenDollard avatar May 25 '21 19:05 KathleenDollard

This sounds like another scenario where something like dotnet new repo would be useful…

terrajobst avatar May 26 '21 15:05 terrajobst

The details of the design can be found here (internal).

bekir-ozturk avatar Aug 30 '21 07:08 bekir-ozturk