Migrate AspNetCompiler to TaskEnvironment API#13424
Merged
OvesN merged 30 commits intodotnet:mainfrom Apr 8, 2026
Merged
Conversation
…https://github.com/OvesN/msbuild into dev/veronikao/migrate-Al-task-to-TaskEnvironment-API
…nment' of https://github.com/OvesN/msbuild into dev/veronikao/Migrate-AspNetCompiler-task-to-TaskEnvironment
…nto dev/veronikao/Migrate-AspNetCompiler-task-to-TaskEnvironment
…nment' of https://github.com/OvesN/msbuild into dev/veronikao/Migrate-AspNetCompiler-task-to-TaskEnvironment
The test relied on FileAttributes.ReadOnly to force File.Delete to throw, but this is not cross-platform - Unix read-only attributes don't prevent deletion.
ApplyEnvironmentOverrides moved inside SetUpProcessStartInfo. Added override for DeleteTempFile using AbsolutePath. Made Driver private again, expose only enum value to decided if driver is multitheaded. Made GetProcessStartInfoMultithreadable private. add overload for DeleteTempFile with AbsolutePath argument
…nto dev/veronikao/Migrate-AspNetCompiler-task-to-TaskEnvironment
JanProvaznik
approved these changes
Apr 7, 2026
Member
|
oh it needs retarget to msbuild main, and please check there are no AspNetCompiler warnings in Linux Core Multithreaded Mode CI job |
Co-authored-by: Jan Provazník <janpro@janpro.dev>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the TaskEnvironment migration by marking AspNetCompiler as multi-threadable and routing tool-path handling through TaskEnvironment APIs, with accompanying unit test updates to validate behavior in a multithreaded environment.
Changes:
- Marked
AspNetCompileras[MSBuildMultiThreadableTask]and updatedGenerateFullPathToTool()to return aTaskEnvironment-absolutized tool path. - Updated
AspNetCompilerunit tests to useITestOutputHelper-backed engines/loggers and added NETFRAMEWORK-only tests for TaskEnvironment integration. - Added
TaskEnvironment.DriverKindplumbing and updatedToolTask.GetProcessStartInfo()flow to branch for multithreaded drivers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Utilities/ToolTask.cs | Adjusts GetProcessStartInfo flow to account for multithreaded TaskEnvironment execution. |
| src/Tasks/AspNetCompiler.cs | Marks task multi-threadable and absolutizes resolved tool path via TaskEnvironment. |
| src/Tasks.UnitTests/AspNetCompiler_Tests.cs | Adds TaskEnvironment-focused tests (NETFRAMEWORK) and plumbs xUnit output into engines/loggers. |
| src/Framework/TaskEnvironment.cs | Introduces internal driver-kind identification used by Utilities to branch behavior. |
SimaTian
approved these changes
Apr 8, 2026
dfederm
pushed a commit
to dfederm/msbuild
that referenced
this pull request
Apr 9, 2026
Fixes dotnet#13421 ## Context The AspNetCompiler task was made thread-safe. ## Changes Made ### AspNetCompiler.cs - Routed file existence checks and path resolution through TaskEnvironment.GetAbsolutePath(). ## Testing ### AspNetCompiler_Tests.cs - **`GenerateFullPathToTool_ReturnsAbsolutePathOrNull`** — validates the `TaskEnvironment.GetAbsolutePath()` integration by constructing a `MultiThreadedTaskEnvironmentDriver` with a custom project directory and verifying the returned path is absolute (or null when the tool is not found). - **`GetProcessStartInfo_UsesTaskEnvironmentWorkingDirectory`** — verifies that the working directory from `MultiThreadedTaskEnvironmentDriver` is propagated to the child process `ProcessStartInfo`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13421
Context
The AspNetCompiler task was made thread-safe.
Changes Made
AspNetCompiler.cs
Testing
AspNetCompiler_Tests.cs
GenerateFullPathToTool_ReturnsAbsolutePathOrNull— validates theTaskEnvironment.GetAbsolutePath()integration by constructing aMultiThreadedTaskEnvironmentDriverwith a custom project directory and verifying the returned path is absolute (or null when the tool is not found).GetProcessStartInfo_UsesTaskEnvironmentWorkingDirectory— verifies that the working directory fromMultiThreadedTaskEnvironmentDriveris propagated to the child processProcessStartInfo.Notes