Skip to content

dotnet new sln is not using templates from the right version #51669

@333fred

Description

@333fred

Describe the bug

I have the following SDKs installed:

8.0.120 [/home/fred/.local/share/dnvm/dn/sdk]
8.0.414 [/home/fred/.local/share/dnvm/dn/sdk]
9.0.306 [/home/fred/.local/share/dnvm/dn/sdk]
10.0.100 [/home/fred/.local/share/dnvm/dn/sdk]

When running dotnet new sln, logs indicate that the templates being used are from the 9.0.306 SDK, not the 10.0.100 SDK.

To Reproduce

  1. Install both 9.0.xxx and 10.0.xxx versions of the SDK.
  2. Run dotnet new sln -v diag

Expected: dirname.slnx is created.
Actual: dirname.sln is created.

The diag output is below.

Further technical details

details of dotnet --info

[I]at 15:20:29 in /tmp/test via .NET 10.0.100
➜ dotnet --info
.NET SDK:
 Version:           10.0.100
 Commit:            b0f34d51fc
 Workload version:  10.0.100-manifests.4c0ca8ba
 MSBuild version:   18.0.2+b0f34d51f

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  24.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /home/fred/.local/share/dnvm/dn/sdk/10.0.100/

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
  Version:      10.0.0
  Architecture: x64
  Commit:       b0f34d51fc

.NET SDKs installed:
  8.0.120 [/home/fred/.local/share/dnvm/dn/sdk]
  8.0.414 [/home/fred/.local/share/dnvm/dn/sdk]
  9.0.306 [/home/fred/.local/share/dnvm/dn/sdk]
  10.0.100 [/home/fred/.local/share/dnvm/dn/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.20 [/home/fred/.local/share/dnvm/dn/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.10 [/home/fred/.local/share/dnvm/dn/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.0 [/home/fred/.local/share/dnvm/dn/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.20 [/home/fred/.local/share/dnvm/dn/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.10 [/home/fred/.local/share/dnvm/dn/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.0 [/home/fred/.local/share/dnvm/dn/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT                              [/home/fred/.local/share/dnvm/dn]

global.json file:
  /tmp/test/global.json

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

[I]at 15:20:33 in /tmp/test via .NET 10.0.100
➜ dotnet new sln -v diag
[2025-11-11 15:20:42.350] [Debug] [Template Engine] => [Execute]: Execute started
[2025-11-11 15:20:42.412] [Debug] [Microsoft.TemplateEngine.Edge.TemplateConstraintManager] => [Execute]: Found 5 constraints factories, initializing.
[2025-11-11 15:20:42.412] [Debug] [Microsoft.TemplateEngine.Edge.TemplateConstraintManager] => [Execute]: Found 5 constraints factories, initializing.
[2025-11-11 15:20:42.413] [Debug] [MSBuildEvaluator] => [Execute]: Output directory is: /tmp/test.
[2025-11-11 15:20:42.413] [Debug] [MSBuildEvaluator] => [Execute]: Project full path is: <null>.
[2025-11-11 15:20:42.414] [Debug] [MSBuildEvaluator] => [Execute]: Found project files: .
[2025-11-11 15:20:42.414] [Debug] [MSBuildEvaluator] => [Execute]: No project found.
[2025-11-11 15:20:42.422] [Debug] [Template Engine] => [Execute] => [Template from config /home/fred/.local/share/dnvm/dn/templates/9.0.10/microsoft.dotnet.common.itemtemplates.9.0.306.nupkg/content/Solution/.template.config/template.json]: Template from config /home/fred/.local/share/dnvm/dn/templates/9.0.10/microsoft.dotnet.common.itemtemplates.9.0.306.nupkg/content/Solution/.template.config/template.json started
[2025-11-11 15:20:42.436] [Debug] [Template Engine] => [Execute] => [Template from config /home/fred/.local/share/dnvm/dn/templates/9.0.10/microsoft.dotnet.common.itemtemplates.9.0.306.nupkg/content/Solution/.template.config/template.json]: Template from config /home/fred/.local/share/dnvm/dn/templates/9.0.10/microsoft.dotnet.common.itemtemplates.9.0.306.nupkg/content/Solution/.template.config/template.json finished, took 13 ms
[2025-11-11 15:20:42.436] [Debug] [Template Engine] => [Execute]: Found template 'Solution File' (Microsoft.Standard.QuickStarts.Solution)
[2025-11-11 15:20:42.436] [Debug] [Microsoft.TemplateEngine.Edge.Template.TemplateCreator] => [Execute] => [Template content generation]: Template content generation started
[2025-11-11 15:20:42.456] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}identity' was assigned to value 'test'.
[2025-11-11 15:20:42.456] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}safe_name' was assigned to value 'test'.
[2025-11-11 15:20:42.456] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}lower_safe_name' was assigned to value 'test'.
[2025-11-11 15:20:42.456] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}safe_namespace' was assigned to value 'test'.
[2025-11-11 15:20:42.456] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}lower_safe_namespace' was assigned to value 'test'.
[2025-11-11 15:20:42.456] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'Format{-VALUE-FORMS-}identity' was assigned to value 'sln'.
[2025-11-11 15:20:42.466] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}identity' was assigned to value 'test'.
[2025-11-11 15:20:42.466] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}safe_name' was assigned to value 'test'.
[2025-11-11 15:20:42.466] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}lower_safe_name' was assigned to value 'test'.
[2025-11-11 15:20:42.466] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}safe_namespace' was assigned to value 'test'.
[2025-11-11 15:20:42.466] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}lower_safe_namespace' was assigned to value 'test'.
[2025-11-11 15:20:42.466] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'Format{-VALUE-FORMS-}identity' was assigned to value 'sln'.
[2025-11-11 15:20:42.469] [Debug] [Microsoft.TemplateEngine.Edge.Template.TemplateCreator] => [Execute] => [Template content generation]: Template content generation finished, took 32 ms
The template "Solution File" was created successfully.

[2025-11-11 15:20:42.470] [Debug] [Template Engine] => [Execute]: Execute finished, took 121 ms

Metadata

Metadata

Assignees

Labels

Area-Common templatesCovers templates in the repo (classlib, console, common item templates)Area-TemplatesuntriagedRequest triage from a team member

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions