dotnet/msbuild

Conditions on item metadata are evaluated even for empty item group

Open

#4,056 建立於 2019年1月9日

在 GitHub 查看
 (1 留言) (2 反應) (0 負責人)C# (1,364 fork)batch import
Area: Enginehelp wantedtriaged

倉庫指標

Star
 (5,062 star)
PR 合併指標
 (平均合併 11天 7小時) (30 天內合併 125 個 PR)

描述

Steps to reproduce

Project file

<Project>
  <Target Name="Build">
    <ItemGroup>
      <X Include="@(Empty)">
        <M Condition="!%(P)">not P</M>
      </X>
    </ItemGroup>
  </Target>
</Project>

I'd expect the condition to not be evaluated since @(Empty) is empty, so there are no items being added to X.

Expected behavior

No error reported.

Actual behavior

error MSB4113: Specified condition "!%(P)" evaluates to "!" instead of a boolean.

Environment data

msbuild /version output:

Microsoft (R) Build Engine version 15.9.14-preview+gae560092f5 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

15.9.14.22190

貢獻者指南