Clarify some aspects of dotnet run -#52132
Merged
jjonescz merged 2 commits intodotnet:release/10.0.2xxfrom Dec 15, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.propsdoesn't affect stdin-based runs (must use#:propertydirective 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 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was referenced Dec 11, 2025
333fred
approved these changes
Dec 12, 2025
This was referenced Dec 16, 2025
This was referenced Feb 12, 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.
Tests and docs only change.