Skip to content

Update System.Net.Http reference to use NuGet #10

@tillig

Description

@tillig

Describe the Bug

When running on .NET 4.6.1, the Autofac.Integration.WebApi.Own assembly appears to reference System.Net.Http 4.0.0.0, but when run on .NET 4.7.1 the reference appears to be System.Net.Http 4.2.0.0 which doesn't exist. This causes runtime failures looking for a missing assembly.

This issue is based on this StackOverflow question.

Steps to Reproduce

Create a project targeting .NET 4.7.1 that uses Autofac.Integration.WebApi.Own 5.0.0. This generates build warnings:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at Owin.AutofacWebApiAppBuilderExtensions.UseAutofacWebApi(IAppBuilder app, HttpConfiguration configuration)

Expected Behavior

The version of System.Net.Http should be found and the project should be built without warnings.

Additional Info

The solution, based on searching, appears to be switching the System.Net.Http reference from a framework/assembly reference to a package reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions