Skip to content

Support launching net taskhost - initial implementation#11393

Merged
YuliiaKovalova merged 25 commits into
dotnet:mainfrom
YuliiaKovalova:dev/ykovalova/support_launching_net_taskhost
Jun 30, 2025
Merged

Support launching net taskhost - initial implementation#11393
YuliiaKovalova merged 25 commits into
dotnet:mainfrom
YuliiaKovalova:dev/ykovalova/support_launching_net_taskhost

Conversation

@YuliiaKovalova
Copy link
Copy Markdown
Member

@YuliiaKovalova YuliiaKovalova commented Feb 5, 2025

Partially Fixes #11331

To test the feature, setup these env variables:
MSBuildToolsDirectoryNET = e.g. "C:\msbuild\msbuild_yk\msbuild\artifacts\bin\bootstrap\core"
MSBuildAssemblyDirectory = e.g. "C:\msbuild\msbuild_yk\msbuild\artifacts\bin\bootstrap\core\sdk\9.0.203"

Keep in mind, due to current handshake mechanism, only matching (or adjusted with this change) version of sdk can be launched.

@YuliiaKovalova YuliiaKovalova force-pushed the dev/ykovalova/support_launching_net_taskhost branch from 2d1cd86 to 9b892e9 Compare February 5, 2025 13:56
@YuliiaKovalova
Copy link
Copy Markdown
Member Author

ExampleNetTask.zip

Copy link
Copy Markdown
Member

@baronfel baronfel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some general questions as I was idly looking at the work so far :) Happy to see this start!

Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Outdated
@YuliiaKovalova YuliiaKovalova changed the title [DRAFT] Support launching net taskhost Support launching net taskhost - initial implementation Feb 14, 2025
@YuliiaKovalova YuliiaKovalova marked this pull request as ready for review February 17, 2025 08:45
@YuliiaKovalova YuliiaKovalova force-pushed the dev/ykovalova/support_launching_net_taskhost branch from ad14fb9 to 65691df Compare February 17, 2025 08:59

This comment was marked as outdated.

@YuliiaKovalova YuliiaKovalova self-assigned this May 22, 2025
@YuliiaKovalova YuliiaKovalova force-pushed the dev/ykovalova/support_launching_net_taskhost branch from 32d4391 to 17589bb Compare May 29, 2025 15:14
Copy link
Copy Markdown
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking things:

  1. breaking net-taskhost-on-net-msbuild
  2. me understanding the "find dotnet & msbuild.exe" plumbing plan.

Comment thread src/Build.UnitTests/BackEnd/BuildManager_Tests.cs Outdated
Comment thread src/Shared/CommunicationsUtilities.cs Outdated
Comment thread src/Shared/CommunicationsUtilities.cs Outdated
Comment thread src/Shared/CommunicationsUtilities.cs Outdated
Comment thread src/Shared/BuildEnvironmentHelper.cs
Comment thread src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Outdated
Comment thread .editorconfig Outdated
Comment thread .editorconfig Outdated
Comment thread src/Build.UnitTests/BackEnd/TaskHostFactory_Tests.cs Outdated
Comment thread src/Build.UnitTests/Instance/TaskItem_Tests.cs Outdated
@YuliiaKovalova YuliiaKovalova force-pushed the dev/ykovalova/support_launching_net_taskhost branch from 1cd482f to 8d5449d Compare June 4, 2025 11:15
@YuliiaKovalova YuliiaKovalova force-pushed the dev/ykovalova/support_launching_net_taskhost branch from fd6a1c7 to f50e7de Compare June 5, 2025 16:07
Copy link
Copy Markdown
Member

@JanProvaznik JanProvaznik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, adding some comments
hopefully my comment on netcore-launching-netcore helps

Comment thread src/Shared/CommunicationsUtilities.cs Outdated
Comment thread src/Shared/CommunicationsUtilities.cs Outdated
Comment thread src/Shared/NodeEndpointOutOfProcBase.cs Outdated
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Shared/CommunicationsUtilities.cs
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
@YuliiaKovalova YuliiaKovalova force-pushed the dev/ykovalova/support_launching_net_taskhost branch from 6f29a34 to d68e199 Compare June 10, 2025 11:23
@YuliiaKovalova YuliiaKovalova requested a review from Copilot June 11, 2025 09:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements initial support for launching the .NET task host by updating the handshake mechanism and environment variable handling. Key changes include refactoring handshake data handling (migrating from raw int arrays to a structured HandshakeComponents type), introducing new environment variables and constants for .NET tools and assembly directories, and updating related tests and documentation comments.

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Shared/NodePipeServer.cs Refactored the handshake loop to use the new HandshakeComponents structure and renamed index usage.
src/Shared/NodePipeClient.cs Updated handshake enumeration and trace messages to reflect the new structure.
src/Shared/NodePipeBase.cs Changed HandshakeComponents type from int[] to a structured type.
src/Shared/NodeEndpointOutOfProcBase.cs Refactored handshake processing and introduced version mismatch logic for NET hosts.
src/Shared/CommunicationsUtilities.cs Updated handshake component creation and introduced the new HandshakeComponents struct.
src/Shared/BuildEnvironmentHelper.cs Added environment variable support for MSBuildToolsDirectoryNET and MSBuildAssemblyDirectory.
src/MSBuild/MSBuild/Microsoft.Build.Core.xsd Updated supported runtime enumeration to include NET.
src/Build/Resources/Constants.cs Introduced new constant definitions for dotnet process and MSBuild assembly/executable names.
src/Build/Instance/TaskFactories/TaskHostTask.cs Updated task host creation to include a new runtime parameter.
src/Build/Evaluation/IntrinsicFunctions.cs Simplified dictionary initialization for handshake parameter creation.
src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs Fixed variable naming in assembly location checks and streamlined comment formatting.
src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Enhanced MSBuild location resolution for both NET and non-NET contexts.
src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs Refactored handshake writing to use the new structured components in node connections.
src/Build/BackEnd/Components/Communications/NodeLauncher.cs Minor comment fixes regarding recursion wording.
src/Build/BackEnd/Components/Communications/DetouredNodeLauncher.cs Updated use of constants for dotnet process name in breakaway child process definitions.
src/Build/BackEnd/Components/Communications/CurrentHost.cs Updated dotnet executable resolution to use newly defined constant names.
src/Build.UnitTests/BackEnd/TaskHostConfiguration_Tests.cs Updated test parameters to use a literal "TaskHost" runtime string.
.editorconfig Inadvertent BOM character appears to be introduced in the file.

Comment thread .editorconfig
Comment thread src/Build.UnitTests/BackEnd/TaskHostConfiguration_Tests.cs
@YuliiaKovalova YuliiaKovalova force-pushed the dev/ykovalova/support_launching_net_taskhost branch from cb1760c to 03360e0 Compare June 11, 2025 09:59
Copy link
Copy Markdown
Member

@JanProvaznik JanProvaznik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See question. Otherwise LGTM as a big step forward in this epic.

Though, I'd appreciate if this PR or the subsequent connected ones added some e2e-ish tests - run framework msbuild on a realistic projectfile which requires net taskhost. This will also uncover other unexpected cases which might require nicer error messages.

Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Build/BackEnd/Components/Communications/CurrentHost.cs
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
@JanProvaznik JanProvaznik self-assigned this Jun 18, 2025
Comment thread src/Shared/NodePipeServer.cs
Comment thread src/Shared/TaskHostConfiguration.cs Outdated
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs Outdated
Comment thread src/Shared/CommunicationsUtilities.cs
Comment thread src/Shared/NodeEndpointOutOfProcBase.cs Outdated
@SimaTian SimaTian mentioned this pull request Jun 25, 2025
Comment thread src/Build.UnitTests/NetTaskHost_E2E_Tests.cs Outdated
Comment thread src/Build.UnitTests/TestAssets/ExampleNetTask/TestNetTask/TestNetTask.csproj Outdated
Comment thread src/Build.UnitTests/TestAssets/ExampleNetTask/ExampleTask/ExampleTask.csproj Outdated
Comment thread src/Shared/CommunicationsUtilities.cs
@YuliiaKovalova YuliiaKovalova merged commit 0e2431a into dotnet:main Jun 30, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support launching .NET taskhost

6 participants