Skip to content

Clarify some aspects of dotnet run - - #52132

Merged
jjonescz merged 2 commits into
dotnet:release/10.0.2xxfrom
jjonescz:sprint-stdin-tests
Dec 15, 2025
Merged

jjonescz merged 2 commits into
dotnet:release/10.0.2xxfrom
jjonescz:sprint-stdin-tests

Conversation

@jjonescz

Copy link
Copy Markdown
Member

Tests and docs only change.

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Dec 11, 2025
@jjonescz
jjonescz requested a review from Copilot December 11, 2025 12:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds test coverage and documentation for the dotnet run - feature (reading C# code from standard input). The changes clarify important behavioral aspects, specifically that the current working directory is used for building/executing even though it's not used to search for other files, and that $(MSBuildStartupDirectory) can be used to reference projects relative to the working directory.

  • Added test coverage verifying working directory behavior for dotnet run -
  • Added tests demonstrating that Directory.Build.props doesn't affect stdin-based runs (must use #:property directive instead)
  • Added tests showing project references work with $(MSBuildStartupDirectory) but not with simple relative paths
  • Enhanced documentation to explain working directory behavior and MSBuildStartupDirectory usage pattern

Reviewed changes

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

File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Enhanced ReadFromStdin test to verify working directory and added two new tests (ReadFromStdin_BuildProps and ReadFromStdin_ProjectReference) to validate Directory.Build.props isolation and project reference behavior
documentation/general/dotnet-run-file.md Added clarification that working directory is still used for building/executing stdin programs and documented the $(MSBuildStartupDirectory) pattern for project references

Comment thread documentation/general/dotnet-run-file.md Outdated
Comment thread documentation/general/dotnet-run-file.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jjonescz
jjonescz merged commit faed16d into dotnet:release/10.0.2xx Dec 15, 2025
24 of 27 checks passed
@jjonescz
jjonescz deleted the sprint-stdin-tests branch December 15, 2025 11:25
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