Skip to content

Piping code into dotnet run - (stdIn) uses wrong work folder #53280

@AThomsen

Description

@AThomsen

Describe the bug

Running this from Powershell:

'Console.WriteLine(System.Environment.CurrentDirectory);' | dotnet run -

outputs

C:\Users\xxx\AppData\Local\Temp\dotnet\runfile\xr3u1zln.ww

I expect it to be the directory the powershell command was run from.

Further technical details

details of dotnet --info

.NET SDK: Version: 10.0.102 Commit: 4452502459 Workload version: 10.0.100-manifests.6d969a7e MSBuild version: 18.0.7+445250245

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.102\

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions