Skip to content

Commit 391d34f

Browse files
authored
Document breaking change: ToolCommandName no longer set for non-tool packages (#50274)
1 parent cc76ba7 commit 391d34f

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
144144
| [HTTP warnings promoted to errors in `dotnet package list` and `dotnet package search`](sdk/10.0/http-warnings-to-errors.md) | Behavioral/source incompatible change |
145145
| [NUGET_ENABLE_ENHANCED_HTTP_RETRY environment variable removed](sdk/10.0/nuget-enhanced-http-retry-removed.md) | Behavioral change |
146146
| [NuGet logs an error for invalid package IDs](sdk/10.0/nuget-packageid-validation.md) | Behavioral change |
147+
| [`ToolCommandName` not set for non-tool packages](sdk/10.0/toolcommandname-not-set.md) | Source incompatible |
147148

148149
## Serialization
149150

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: "Breaking change - ToolCommandName is not set for non tool packages"
3+
description: "Learn about the breaking change in .NET 10 where ToolCommandName is only set for projects with PackAsTool set to true."
4+
ms.date: 12/02/2025
5+
ai-usage: ai-assisted
6+
---
7+
8+
# `ToolCommandName` not set for non-tool packages
9+
10+
The `ToolCommandName` property is no longer set automatically for all projects during build or package operations. It's now only set when `PackAsTool` is set to `true`, indicating that the project is a .NET tool package.
11+
12+
## Version introduced
13+
14+
.NET 10
15+
16+
## Previous behavior
17+
18+
Previously, the `ToolCommandName` property was always set during build or pack operations, regardless of whether the project was configured as a tool package.
19+
20+
## New behavior
21+
22+
Starting in .NET 10, the `ToolCommandName` property is only set when `PackAsTool` is set to `true`, indicating that the project is a .NET tool.
23+
24+
## Type of breaking change
25+
26+
This change can affect [source compatibility](../../categories.md#source-compatibility).
27+
28+
## Reason for change
29+
30+
The `ToolCommandName` property doesn't make sense for non-tool projects. Setting it for all projects was unnecessary and could cause confusion about the project's purpose.
31+
32+
## Recommended action
33+
34+
If your project relies on the `ToolCommandName` property being set, you have two options:
35+
36+
- Set the property explicitly in your project file:
37+
38+
```xml
39+
<PropertyGroup>
40+
<ToolCommandName>your-command-name</ToolCommandName>
41+
</PropertyGroup>
42+
```
43+
44+
- Convert your project to a .NET tool by setting `PackAsTool` to `true`:
45+
46+
```xml
47+
<PropertyGroup>
48+
<PackAsTool>true</PackAsTool>
49+
</PropertyGroup>
50+
```
51+
52+
## Affected APIs
53+
54+
None.

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ items:
176176
href: sdk/10.0/nu1015-packagereference-version.md
177177
- name: PrunePackageReference privatizes direct prunable references
178178
href: sdk/10.0/prune-packagereference-privateassets.md
179+
- name: "'ToolCommandName' not set for non-tool packages"
180+
href: sdk/10.0/toolcommandname-not-set.md
179181
- name: Serialization
180182
items:
181183
- name: System.Text.Json checks for property name conflicts

0 commit comments

Comments
 (0)