Skip to content

Conversation

@jjonescz
Copy link
Member

@jjonescz jjonescz commented Dec 8, 2025

Fixes #52057.

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Dec 8, 2025
@jjonescz jjonescz requested a review from Copilot December 8, 2025 14:08
Copy link
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 pull request addresses issue #52057 by disabling the up-to-date optimization in dotnet-run-file when #:project directives are present in the source file. The up-to-date check cannot currently detect changes in referenced projects, so always rebuilding when project directives are present ensures correctness.

Key changes:

  • Added a check in NeedsToBuild() to skip the up-to-date optimization when project directives exist
  • Added a comprehensive test validating that projects with #:project directives always rebuild, even when the main file hasn't changed

Reviewed changes

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

File Description
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs Added early return in NeedsToBuild() to force rebuilding when CSharpDirective.Project directives are detected
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Added UpToDate_ProjectReferences test verifying that changes in referenced projects are picked up through forced rebuilds

@jjonescz jjonescz marked this pull request as ready for review December 8, 2025 15:05
@jjonescz jjonescz requested a review from a team December 8, 2025 15:05
@jjonescz jjonescz changed the title Skip up-to-date check in dotnet-run-file when there are #:project directives Skip up-to-date optimization in dotnet-run-file when there are #:project directives Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-run-file Items related to the "dotnet run <file>" effort

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants