Skip to content

Forced to Use Microsoft.Extensions.Logging 2.0.0 Even if Using ASP.Net Core 1.1 on net461 #115

Closed
@adamrodger

Description

@adamrodger

The dependencies for Net 4.6.1 upgrade the minimum version of Microsoft.Extensions.Logging to 2.0.0 even though .Net 4.6 only requires 1.0.0.

This means if you install the package into a solution using .Net 4.6.1 and ASP.Net Core 1.1 then you receive an exception at runtime:

System.TypeLoadException : Method 'get_Name' in type 'Microsoft.Extensions.Options.ConfigurationChangeTokenSource`1' from assembly 'Microsoft.Extensions.Options.ConfigurationExtensions, Version=1.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
Stack Trace:
   at Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure[TOptions](IServiceCollection services, IConfiguration config)

I really don't think it makes sense to require different major versions of the same dependency depending on the target framework, especially in a way that can cause runtime exceptions in consuming projects.

The line causing this problem is:

<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />

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