Skip to content

Does not support targeting multiple frameworks with conditions. #182

@dulsi

Description

@dulsi

Steps to reproduce

  1. Create a project.
  2. Add a package.
  3. Modify the project to support multiple frameworks
    <TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
  4. Modify the project so that it uses different packages depending on target framework.
    <ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
        <PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.2" />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetFramework)' == 'net7.0' Or '$(TargetFramework)' == 'net6.0'">
        <PackageReference Include="Microsoft.Net.Http.Headers" Version="2.2.8" />
    </ItemGroup>

Expected behavior
I think the best default would be to just check the latest framework. Probably add a command line argument to specify the framework.

Observed behavior
ArgumentException: An item with the same key has already been added. Key: Microsoft.Net.Http.Headers

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureAdditional or changing functionalitylargeMore than a day's effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions