msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

[Bug]: Building inline task invocation succeeded with an error

Open GangWang01 opened this issue 1 year ago • 2 comments

Issue Description

Building this project that invokes an inline task got strange behavior. The output log displayed the successful task execution as an error, while build succeeded with 1 error.

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- This simple inline task displays "Hello, world!" -->
  <UsingTask
    TaskName="HelloWorld"
    TaskFactory="CodeTaskFactory"
    AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
    <ParameterGroup />
    <Task>
      <Reference Include="System.Xml"/>
      <Using Namespace="System"/>
      <Using Namespace="System.IO"/>
      <Code Type="Fragment" Language="cs">
<![CDATA[
// Display "Hello, world!"
Log.LogError("Hello, world!");
]]>
      </Code>
    </Task>
  </UsingTask>

   <Target Name="Hello">
    <HelloWorld />
  </Target>
</Project>

The build log is: image

Steps to Reproduce

Open Developer Command Prompt and use msbuild.exe to build the project.

Expected Behavior

In the build log task execution is displayed as normal message. Build succeeded without errors.

Actual Behavior

In the build log task execution is displayed as error. Build succeeded with 1 error.

Analysis

No response

Versions & Configurations

No response

GangWang01 avatar Jul 17 '24 07:07 GangWang01