Skip to content

[Bug]: Wrong version of Microsoft.Extensions.DependencyInjection in NuGet #6541

@GerardSmit

Description

@GerardSmit

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

DotNetNuke.DependencyInjection has a wrong version of the dependency Microsoft.Extensions.DependencyInjection.

Steps to reproduce?

  1. Create a new .NET Standard/Core project.
  2. Change the .csproj to:
    <Project Sdk="Microsoft.NET.Sdk">
    
        <PropertyGroup>
            <TargetFramework>net48</TargetFramework>
            <LangVersion>latest</LangVersion>
        </PropertyGroup>
    
        <ItemGroup>
            <PackageReference Include="DotNetNuke.DependencyInjection" Version="10.0.0" />
        </ItemGroup>
    
    </Project>
  3. Build the project.

Current Behavior

A warning gets displayed:

Microsoft.Common.CurrentVersion.targets(2424,5): Warning MSB3277 : Found conflicts between different versions of "Microsoft.Extensions.DependencyInjection.Abstractions" that could not be resolved.
There was a conflict between "Microsoft.Extensions.DependencyInjection.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".

Expected Behavior

No warning/mismatch of versions from Microsoft.Extensions.DependencyInjection

Anything else?

In NuGet, DotNetNuke.DependencyInjection has a dependency to "Microsoft.Extensions.DependencyInjection (>= 7.0.0)".

I think this is because in the nuspec, version 7.0 is declared:

<dependency id="Microsoft.Extensions.DependencyInjection" version="7.0.0" />

But in the actual library/csproj, version 8.0 is declared:

<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />

Workaround

A workaround is adding Microsoft.Extensions.DependencyInjection manually to the .csproj of your library (created in step 2):

<ItemGroup>
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
</ItemGroup>

Affected Versions

10.0.0 (latest v10 release)

What browsers are you seeing the problem on?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions