Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

FileLoadException for System.Runtime.InteropServices.RuntimeInformation on old-style .csproj test projects #697

Closed
@poke

Description

@poke

Hey, I’m currently migrating my projects to .NET Core 2.0 and as part of this, I’ve updated the Microsoft.Extensions.Logging.Console dependency on some test projects to 2.0.

When I run tests that attempt to create a console logger, I get the following error:

Message: System.IO.FileLoadException : Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I assume this is related to the change introduced with #440 that got rid of the PlatformAbstractions dependency. It also works fine for me in new-style .csproj projects (including test projects) but it just fails with old-style test projects. For some odd reason, the same code within a console application runs fine, even on old-style projects.

My test is literally just the following:

[Fact]
public void TestConsoleLogger()
{
    new LoggerFactory().AddConsole().CreateLogger("Test");
}

Is there anything I can do to avoid this problem other than upgrading to the newer .csproj format? I’ve also tried referencing various different kinds of InteropServices in the project but I couldn’t get it to work.

I’ve prepared a minimum test project that reproduces the problem over here.

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