You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/whats-new/dotnet-10/sdk.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,17 +111,17 @@ The output provides a structured, machine-readable description of the command's
111
111
}
112
112
```
113
113
114
-
## Use .NET MSBuild Tasks with .NET Framework MSBuild
114
+
## Use .NET MSBuild tasks with .NET Framework MSBuild
115
115
116
-
MSBuild is the underlying build system for.NET, driving both build of projects (as seenin commands like `dotnet build` and `dotnet pack`), as well as acting as a general provider of information about projects (as seen in commands like `dotnet list package`, and implicitly used by commands like `dotnet run` to discover how a project wants to be executed).
116
+
MSBuild is the underlying build system for.NET, driving both build of projects (as seenin commands like `dotnet build` and `dotnet pack`), and acting as a general provider of information about projects (as seen in commands like `dotnet list package`, and implicitly used by commands like `dotnet run` to discover how a project wants to be executed).
117
117
118
-
When running `dotnet` CLI commands, the version of MSBuild that is used is the one that is shipped with the .NET SDK. However, when using Visual Studio or invoking MSBuild directly, the version of MSBuild that is used is the one that is installed with Visual Studio. This environment difference has a few important consequences. The most important is that MSBuild running in Visual Studio (or through `msbuild.exe`) is a .NET Framework application, while MSBuild running in the `dotnet` CLI is a .NET application. This means that any MSBuild tasks that are written to run on .NET cannot be used when building in Visual Studio or when using `msbuild.exe`.
118
+
When running `dotnet` CLI commands, the version of MSBuild that is used is the one that is shipped with the .NET SDK. However, when using Visual Studio or invoking MSBuild directly, the version of MSBuild that is used is the one that is installed with Visual Studio. This environment difference has a few important consequences. The most important is that MSBuild running in Visual Studio (or through `msbuild.exe`) is a .NET Framework application, while MSBuild running in the `dotnet` CLI is a .NET application. This means that any MSBuild tasks that are written to run on .NET can't be used when building in Visual Studio or when using `msbuild.exe`.
119
119
120
-
Starting with .NET 10, `msbuild.exe` and Visual Studio 2026 can run MSBuild tasks that are built for.NET. This means that you can now use the same MSBuild tasks when buildingin Visual Studio or using `msbuild.exe` as you do when building with the `dotnet` CLI. For most .NET users, this won't change anything, but for authors of custom MSBuild tasks, this means that you can now write your tasks to target .NET and have them work everywhere. The goal with this change is to make it easier to write and share MSBuild tasks, and to allow task authors to take advantage of the latest features in .NET—in addition to reducing the difficulties around multi-targeting tasks to support both .NET Framework and .NET, and dealing with versions of .NET Framework dependencies that are implicitly available in the MSBuild .NET Framework execution space.
120
+
Starting with .NET 10, `msbuild.exe` and Visual Studio 2026 can run MSBuild tasks that are built for .NET. This means that you can now use the same MSBuild tasks when building in Visual Studio or using `msbuild.exe` as you do when building with the `dotnet` CLI. For most .NET users, this won't change anything. Butforauthors of custom MSBuild tasks, this means that you can now write your tasks to target .NET and have them work everywhere. The goal with this change is to make it easier to write and share MSBuild tasks, and to allow task authors to take advantage of the latest featuresin .NET. In addition, this change reduces the difficulties around multi-targeting tasks to support both .NET Framework and .NET, and dealing with versions of .NET Framework dependencies that are implicitly available in the MSBuild .NET Framework execution space.
121
121
122
-
### Configure .NET Tasks
122
+
### Configure .NET tasks
123
123
124
-
For task authors, opting in to this new behavior should be pretty simple—all it should take is changing your `UsingTask` declaration to tell MSBuild about your task.
124
+
For task authors, it's easy to opt into this new behavior. Just change your `UsingTask` declaration to tell MSBuild about your task.
125
125
126
126
```xml
127
127
<UsingTask TaskName="MyTask"
@@ -133,14 +133,14 @@ For task authors, opting in to this new behavior should be pretty simple—all i
133
133
134
134
The `Runtime="NET"` and `TaskFactory="TaskHostFactory"` attributes tell the MSBuild engine how to run the Task:
135
135
136
-
- `Runtime="NET"` tells MSBuild that the Task is built for .NET (as opposed to .NET Framework)
136
+
- `Runtime="NET"` tells MSBuild that the Task is built for .NET (as opposed to .NET Framework).
137
137
- `TaskFactory="TaskHostFactory"` tells MSBuild to use the `TaskHostFactory` to run the Task, which is an existing capability of MSBuild that allows tasks to be run out-of-process.
138
138
139
139
### Caveats and performance tuning
140
140
141
-
The preceding example is the simplest way to get started using .NET Tasks in MSBuild, but it has some limitations—because the `TaskHostFactory` always runs tasks out-of-process, the new .NET Task always runs in a separate process from MSBuild. This means that there is some minor overhead to running the Task because the MSBuild engine and the Task communicate over inter-process communication (IPC) instead of in-process communication. For most tasks, this overhead is negligible, but for tasks that are run many times in a build, or that do quite a lot of logging, this overhead might be more significant.
141
+
The preceding example is the simplest way to get started using .NET tasks in MSBuild, but it has some limitations. Because the `TaskHostFactory` always runs tasks out-of-process, the new .NET task always runs in a separate process from MSBuild. This means that there is some minor overhead to running the task because the MSBuild engine and the task communicate over inter-process communication (IPC) instead of in-process communication. For most tasks, this overhead is negligible, but for tasks that are run many times in a build, or that do a lot of logging, this overhead might be more significant.
142
142
143
-
With just a bit more work, the Task can be configured to still run in-process when running via `dotnet`:
143
+
With just a bit more work, you can configure the task to still run in-process when running via `dotnet`:
144
144
145
145
```xml
146
146
<UsingTask TaskName="MyTask"
@@ -158,7 +158,7 @@ With just a bit more work, the Task can be configured to still run in-process wh
158
158
159
159
Thanks to the `Condition` feature of MSBuild, you can load a Task differently depending on whether MSBuild is running in .NET Framework (Visual Studio or `msbuild.exe`) or .NET (the `dotnet` CLI). In this example, the Task runs out-of-process when running in Visual Studio or `msbuild.exe`, but runs in-process when running in the `dotnet` CLI. This gives the best performance when running in the `dotnet` CLI, while still allowing the Task to be used in Visual Studio and `msbuild.exe`.
160
160
161
-
There are also small technical limitations to be aware of when using .NET Tasks in MSBuild—the most notable of which is that the `Host Object` feature of MSBuild Tasks is not yet supported for .NET Tasks running out-of-process. This means that if your Task relies on a Host Object, it won't work when running in Visual Studio or `msbuild.exe`. Additional support forHost Objects is plannedin future releases.
161
+
There are also small technical limitations to be aware of when using .NET Tasks in MSBuild—the most notable of which is that the `Host Object` feature of MSBuild Tasks isn't yet supported for.NET Tasks running out-of-process. This means that if your Task relies on a Host Object, it won't work when runningin Visual Studio or `msbuild.exe`. Additional support forHost Objects is plannedin future releases.
0 commit comments