Skip to content

Commit 6013d6b

Browse files
BillWagnergewarrenmeaghanlewis
authored
Apply suggestions from code review
Co-authored-by: Genevieve Warren <[email protected]> Co-authored-by: Meaghan Osagie (Lewis) <[email protected]>
1 parent 0b459f6 commit 6013d6b

File tree

1 file changed

+10
-10
lines changed
  • docs/core/whats-new/dotnet-10

1 file changed

+10
-10
lines changed

docs/core/whats-new/dotnet-10/sdk.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,17 @@ The output provides a structured, machine-readable description of the command's
111111
}
112112
```
113113
114-
## Use .NET MSBuild Tasks with .NET Framework MSBuild
114+
## Use .NET MSBuild tasks with .NET Framework MSBuild
115115
116-
MSBuild is the underlying build system for .NET, driving both build of projects (as seen in 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 seen in 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).
117117
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`.
119119
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, 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. 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, 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.
121121
122-
### Configure .NET Tasks
122+
### Configure .NET tasks
123123
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.
125125
126126
```xml
127127
<UsingTask TaskName="MyTask"
@@ -133,14 +133,14 @@ For task authors, opting in to this new behavior should be pretty simple—all i
133133
134134
The `Runtime="NET"` and `TaskFactory="TaskHostFactory"` attributes tell the MSBuild engine how to run the Task:
135135
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).
137137
- `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.
138138
139139
### Caveats and performance tuning
140140
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.
142142
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`:
144144
145145
```xml
146146
<UsingTask TaskName="MyTask"
@@ -158,7 +158,7 @@ With just a bit more work, the Task can be configured to still run in-process wh
158158
159159
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`.
160160
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 for Host Objects is planned in 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 running in Visual Studio or `msbuild.exe`. Additional support for Host Objects is planned in future releases.
162162
163163
### Future work
164164

0 commit comments

Comments
 (0)