Skip to content

[Bug]: Recent ToolTask change causes Exec task to miss output #10378

@akoeplinger

Description

@akoeplinger

Issue Description

Pretty sure this was caused by #10297. The output of an Exec task is empty even when it shouldn't be.

Steps to Reproduce

Project:

<Project>
  <Target Name="FindLSCommand">
    <Exec Command="command -v ls"
          StandardOutputImportance="Low"
          EchoOff="true"
          ContinueOnError="ErrorAndContinue"
          ConsoleToMsBuild="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="LS_COMMAND" />
    </Exec>

    <Error Condition="'$(LS_COMMAND)' == ''" Text="ls command not found" />
  </Target>
</Project>

Running this with dotnet msbuild /t:FindLSCommand results in the error.

Expected Behavior

Build succeeded in 0,1s

Actual Behavior

  build failed with 1 error(s) (0,0s)
    /Users/alexander/dev/test/msbuildbug/build.proj(11,5): error : ls command not found

Build failed with 1 error(s) in 0,1s

Locally I'm seeing this reproduce almost 100% but in CI it doesn't seem to be that common.

Analysis

Running with MSBUILDDISABLEFEATURESFROMVERSION=17.12 fixes the issue so I'm reasonably certain it is because of #10297

Versions & Configurations

dotnet-sdk-9.0.100-preview.7.24365.21-osx-arm64
msbuild 17.12.0.36502

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions