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

贡献者指南