Repository navigation
[Epic] Common template features for .NET templates (sln, editorconfig) #3208
Description
Activity
Can you share a bit more details what are you expecting here? Do you expect
dotnet new editorconfiglike #3195 suggests or you expectdotnet new consoleto include.editorconfigfile?- addedarea: template-contentThe issue is related to content of template packages managed in this repo (/template_feed)The issue is related to content of template packages managed in this repo (/template_feed)need-customer-infoRequires feedback from authorRequires feedback from author
on May 25, 2021 Both but my issue is with regards to
dotnet new consoleto 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-projectReacted by Immo Landwerth@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.
- The template team maintains the .NET standard .editorconfig. Logically this is the same one you get with
This sounds like another scenario where something like
dotnet new repowould be useful…- addedtriagedThe issue was evaluated by the triage team, placed on correct area, next action defined.The issue was evaluated by the triage team, placed on correct area, next action defined.and removedneed-customer-infoRequires feedback from authorRequires feedback from author
on May 31, 2021 - addedEpicGroups multiple user stories. Can be grouped under a theme.Groups multiple user stories. Can be grouped under a theme.
on Aug 30, 2021 - changed the title
[-]EditorConfig files to be automatically included in dotnet new[/-][+]Default template features for .NET templates[/+]on Aug 30, 2021 The details of the design can be found here (internal).
- changed the title
[-]Default template features for .NET templates[/-][+][Epic] Default template features for .NET templates[/+]on Aug 31, 2021 - removedEpicGroups multiple user stories. Can be grouped under a theme.Groups multiple user stories. Can be grouped under a theme.
on Aug 31, 2021 - changed the title
[-][Epic] Default template features for .NET templates[/-][+][Epic] Common template features for .NET templates (sln, editorconfig)[/+]on Sep 14, 2021 - addedfeatureThe issue defines new feature.The issue defines new feature.gathering-feedbackThe issue requires feedback in order to be planned, please comment if the feature is useful for youThe issue requires feedback in order to be planned, please comment if the feature is useful for youarea: authoringEnhancements to the process of authoring, maintaining, and testing templatesEnhancements to the process of authoring, maintaining, and testing templatesPriority:2Work that is important, but not critical for the releaseWork that is important, but not critical for the release
on May 18, 2023 Hi - this multi-template workflow is something I've solved in dotnet-template-mcp, an MCP server that wraps the .NET Template Engine for AI-assisted scaffolding.
The
template_composetool chains multiple template operations in a single call:[ {"templateName": "webapi", "name": "MyApi", "outputPath": "./src", "parametersJson": "{\"auth\": \"Individual\"}"}, {"templateName": "sln", "name": "MyApi"}, {"templateName": "gitignore", "target": "."} ]This creates the project, the solution file, and the .gitignore in one step — exactly the
dotnet new <TEMPLATE> --slnworkflow requested here. The server also auto-adds the project to the solution.Additionally,
solution_analyzeinspects existing.slnfiles to understand the workspace context before creation, so the agent can make informed decisions about where to place new projects.It doesn't replace a native CLI flag, but for AI-assisted development workflows it solves the same pain point today. Available as:
dotnet tool install -g DotnetTemplateMCP.Reacted by FrulfumpReacted by Frulfump- addedtriage:transfer-to-sdkIssue should be transferred to dotnet/sdkIssue should be transferred to dotnet/sdk
on May 7, 2026
Audience: template authors
Background
At the moment a lot of .NET project templates have to manually create similar configuration related to:
Moreover more common features will be nice to have:
editorconfig(original intention of the issue)Implementing all of above is possible but will result in extra ~300 lines configuration in
template.jsonand corresponding testing and maintenance effort. The configuration will be very similar to the same in all the templates.Technical suggestion
We are considering to create a specific generator for .NET project templates which implicitly supports the features above.
All the author needs to do is to opt-in to desired behaviors via corresponding feature flags.
Justification
original description below
Copying Kathleen's comments from below:
The part about -sln is probably not relevant. Therefore, it should be considered out of the scope of this issue.