Skip to content

Using latest ValueTuple package in .NET 4.7.1 or later in a project that has source authored bindingRedirects results in warning MSB3836 or FileNotFoundException #258

@ericstj

Description

@ericstj

If a project already has a source-authored bindingRedirects in app.config that downgrade the ValueTuple assembly version, the following warning may be emitted:

warning MSB3836: The explicit binding redirect on "System.ValueTuple, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" conflicts with an autogenerated binding redirect. Consider removing it from the application configuration file or disabling autogenerated binding redirects. The build will replace it with: "<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" xmlns="urn:schemas-microsoft-com:asm.v1" />".

If that project is then run after the redirects are rewritten, or if other redirects (not downgrade) existed, a runtime error like the following will occur.

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

In both cases the fix is to remove the bindingRedirectm for System.ValueTuple. System.ValueTuple is present in .NET 4.7.1 and later and does not require bindingRedirects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions