Do not include forwarded --target option in build arguments#53503
Merged
tmat merged 1 commit intodotnet:release/10.0.3xxfrom Mar 19, 2026
Merged
Do not include forwarded --target option in build arguments#53503tmat merged 1 commit intodotnet:release/10.0.3xxfrom
tmat merged 1 commit intodotnet:release/10.0.3xxfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses dotnet watch test reliability on .NET 10 (#52528) by ensuring watch-controlled MSBuild targets aren’t overridden by forwarded --target options, and adds coverage for the failing “fix-and-continue testing” scenario. It also contains a broad set of dotnet-watch refactors that convert many files to file-scoped namespaces and remove unused usings.
Changes:
- Filter out forwarded MSBuild
--target/-toptions from watch build arguments so watch can control the targets it runs. - Add/extend
dotnet watch testscenario coverage to validate reruns after an initial failing test. - Large formatting/refactor pass across dotnet-watch (file-scoped namespaces, indentation, unused using cleanup).
Reviewed changes
Copilot reviewed 93 out of 93 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet-watch.Tests/Web/RSATests.cs | Removes unused usings (style-only). |
| test/dotnet-watch.Tests/Watch/NoRestoreTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/Watch/GlobbingAppTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/Watch/FileUpdateTests.cs | Adds dotnet watch test regression test for issue #52528. |
| test/dotnet-watch.Tests/Watch/BuildEvaluatorTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/TestUtilities/TestReporter.cs | File-scoped namespace + formatting changes to test utility. |
| test/dotnet-watch.Tests/TestUtilities/TestConsole.cs | File-scoped namespace + formatting changes to test utility. |
| test/dotnet-watch.Tests/TestUtilities/TaskExtensions.cs | File-scoped namespace + formatting changes to test utility. |
| test/dotnet-watch.Tests/TestUtilities/DotNetWatchTestBase.cs | Removes unused using. |
| test/dotnet-watch.Tests/HotReload/TerminationTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/HotReload/SourceFileUpdateTests.HotReloadNotSupported.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/HotReload/MetadataUpdateHandlerTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/HotReload/MauiHotReloadTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/HotReload/LoggingTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/HotReload/BuildProjectsTests.cs | Removes unused using. |
| test/dotnet-watch.Tests/ConsoleReporterTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/CommandLine/SubcommandTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/CommandLine/ProgramTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/CommandLine/ProgramTests.HostArguments.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/CommandLine/ProgramTests.Arguments.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch.Tests/CommandLine/LaunchSettingsTests.cs | File-scoped namespace + formatting changes to tests. |
| test/dotnet-watch-test-browser/Program.cs | Removes unused usings. |
| test/TestAssets/TestProjects/XUnitTestProject/XUnitTestProject.csproj | Switches to version properties for xunit/test sdk references (but currently inconsistent with repo’s test asset versioning setup). |
| test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj | Adds assembly metadata for test package versions. |
| src/Dotnet.Watch/dotnet-watch/Watch/StaticFileHandler.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/dotnet-watch/Watch/MsBuildFileSetFactory.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/dotnet-watch/Watch/MSBuildFileSetResult.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/dotnet-watch/Watch/DotNetWatcher.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/dotnet-watch/Watch/BuildEvaluator.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/dotnet-watch/Properties/launchSettings.json | Changes debug profile args + working directory (currently machine-specific). |
| src/Dotnet.Watch/dotnet-watch/CommandLine/CommandLineOptions.cs | Filters forwarded --target option from build args. |
| src/Dotnet.Watch/Web.Middleware/ResponseStreamWrapper.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Web.Middleware/HostingStartup.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Web.Middleware/BrowserScriptMiddleware.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Web.Middleware/BlazorWasmHotReloadMiddleware.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Web.Middleware/ApplicationPaths.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Utilities/ProcessUtilities.cs | Removes unused usings. |
| src/Dotnet.Watch/Watch/UI/TargetFrameworkSelectionPrompt.cs | Removes unused usings. |
| src/Dotnet.Watch/Watch/UI/RestartPrompt.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/UI/PhysicalConsole.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/UI/IConsole.cs | Removes outdated interface doc comment. |
| src/Dotnet.Watch/Watch/UI/ConsoleReporter.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/UI/ConsoleInputReader.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Process/RunningProject.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Process/ProjectLauncher.cs | Removes unused using. |
| src/Dotnet.Watch/Watch/Process/ProcessSpec.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Process/ProcessLaunchResult.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Process/LaunchSettingsProfile.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Process/IRuntimeProcessLauncherFactory.cs | Removes unused using. |
| src/Dotnet.Watch/Watch/HotReload/HotReloadProjectUpdatesBuilder.cs | Removes unused using. |
| src/Dotnet.Watch/Watch/FileWatcher/PollingDirectoryWatcher.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/FileWatcher/EventBasedDirectoryWatcher.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Context/EnvironmentOptions.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Context/DotNetWatchContext.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Build/ProjectGraphUtilities.cs | Removes unused using. |
| src/Dotnet.Watch/Watch/Build/LoadedProjectGraph.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Build/FileItem.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/Watch/Browser/BrowserRefreshServerFactory.cs | Removes unused using. |
| src/Dotnet.Watch/Watch/Browser/BrowserLauncher.cs | Removes unused using. |
| src/Dotnet.Watch/Watch.Aspire/Server/WatchStatusEvent.cs | Removes unused using. |
| src/Dotnet.Watch/Watch.Aspire/Server/WatchControlReader.cs | Removes unused using. |
| src/Dotnet.Watch/Watch.Aspire/Program.cs | Removes unused using. |
| src/Dotnet.Watch/Watch.Aspire/Host/AspireHostLauncher.cs | Removes unused using. |
| src/Dotnet.Watch/HotReloadClient/Web/StaticWebAsset.cs | Removes unused usings. |
| src/Dotnet.Watch/HotReloadClient/Web/AbstractBrowserRefreshServer.cs | Removes unused usings. |
| src/Dotnet.Watch/HotReloadClient/Utilities/ResponseFunc.cs | Removes unused usings. |
| src/Dotnet.Watch/HotReloadClient/Utilities/PathExtensions.cs | Removes unused using. |
| src/Dotnet.Watch/HotReloadClient/Logging/LogEvents.cs | Removes unused using. |
| src/Dotnet.Watch/HotReloadClient/HotReloadClients.cs | Removes unused usings. |
| src/Dotnet.Watch/HotReloadAgent/MetadataUpdateHandlerInvoker.cs | Removes unused using. |
| src/Dotnet.Watch/HotReloadAgent.WebAssembly.Browser/WebAssemblyHotReload.cs | Removes unused usings. |
| src/Dotnet.Watch/DotNetWatchTasks/Utilities/RequiredMemberAttribute.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/DotNetWatchTasks/Utilities/IsExternalInit.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/DotNetWatchTasks/Utilities/CompilerFeatureRequiredAttribute.cs | File-scoped namespace + formatting changes. |
| src/Dotnet.Watch/DotNetWatchTasks/FileSetSerializer.cs | File-scoped namespace + formatting changes. |
| eng/Versions.props | Adds XUnit VS runner version property. |
src/Dotnet.Watch/dotnet-watch/CommandLine/CommandLineOptions.cs
Outdated
Show resolved
Hide resolved
test/TestAssets/TestProjects/XUnitTestProject/XUnitTestProject.csproj
Outdated
Show resolved
Hide resolved
b881607 to
933bcc9
Compare
Member
Author
|
@DustinCampbell ptal |
DustinCampbell
approved these changes
Mar 19, 2026
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 #52528