Skip to content

Support ItemDefinitionGroup in Choose/When #5436

@ss8104

Description

@ss8104

Steps to reproduce

I am trying to set copy local false in all my projects (outputtype=library)from the Driectory.build.props file in the root folder.

<When Condition=" '$(OutputType)'=='Library' ">
    <ItemDefinitionGroup>
        <Reference>
            <Private>False</Private>
        </Reference>
        <ProjectReference>
            <Private>False</Private>
        </ProjectReference>
    </ItemDefinitionGroup>
</When>
<When Condition=" '$(OutputType)'=='exe' ">
    <ItemDefinitionGroup>
        <Reference>
            <Private>True</Private>
        </Reference>
        <ProjectReference>
            <Private>True</Private>
        </ProjectReference>
    </ItemDefinitionGroup>
</When>

should I be able to use conditional constructs this way?
I tried above but get an error

The element <ItemDefinitionGroup> beneath element <When> is unrecognized.

Metadata

Metadata

Assignees

Labels

Area: LanguageIssues impacting the MSBuild programming language.help wantedIssues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim.triaged

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions