dotnet/msbuild

Conditions on item metadata are evaluated even for empty item group

Open

#4056 aperta il 9 gen 2019

Vedi su GitHub
 (1 commento) (2 reazioni) (0 assegnatari)C# (1364 fork)batch import
Area: Enginehelp wantedtriaged

Metriche repository

Star
 (5062 star)
Metriche merge PR
 (Merge medio 11g 7h) (125 PR mergiate in 30 g)

Descrizione

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

Guida contributor