[release/10.0.1xx] Fix working directory of simple file-based apps#53803
[release/10.0.1xx] Fix working directory of simple file-based apps#53803jjonescz merged 2 commits intorelease/10.0.1xxfrom
Conversation
The usual project-based dotnet run doesn't use the current working directory AFAIK. It uses |
Yes, good point, they are respected. They default to the current working directory. And simple file-based apps cannot overwrite them (if they did, they wouldn't be simple anymore and would use msbuild and hence also RunWorkingDirectory). So using the current working directory is the correct default. |
Backport of #51828 to release/10.0.1xx
/cc @jjonescz
Description
Fixes a bug where
dotnet run path/to/file.cshas a wrong working directory (it uses directory of the file, not the current working directory like usual fordotnet run). This only affects simple file-based apps (which skip MSBuild and invoke the C# compiler directly), hence it can be worked around with--no-cache(which skips this optimized path).Customer impact
This was reported by several customers on GitHub. It has been fixed in 10.0.200 but it sill continues to be reported. Hence I think it would be good to backport this simple fix to 10.0.1xx.
Regression
Not since GA. This might have worked in some .NET 10 previews though (before we had the optimized path that introduced the bug).
Risk
Low. A simple change with narrow impact. Already released in 10.0.200. Unit test coverage.