Binding Re-directs

Posted by: Charles.Jimenez on 6 November 2025, 2:27 pm EST

  • Posted 6 November 2025, 2:27 pm EST

    In my project, Visual Studio is issuing warnings about binding re-directs due to conflicts in reference assembly versions. I am using .Net Framework 4.8.

    A typical example is for System.ValueTuple. The version of System.ValueTuple in the official .Net Framework 4.8 is 4.0.2.0. However, the C1 Component C1.Document.4.6.2 references System.ValueTuple 4.0.3.0, which is part of the C1 Winforms distribution.

    Visual Studio resolves this by picking the 4.0.2.0 version of System.ValueTuple because “it is primary”, whatever that means. There is no other need to reference System.ValueTuple except for C1.Document.4.6.2.

    So my question is, how can I force VS2022 to pick the later version? And if not, what is the risk of this causing an issue in the future?

    Thank you,

    Charlie

  • Posted 7 November 2025, 10:17 am EST

    Hello Charlie,

    The runtime uses the version in the Global Assembly Cache (GAC) if it exists. If multiple versions of an assembly are referenced, the runtime tries to unify them to the ‘primary’ version. (see: https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions)

    If you want to use the assembly included with C1, add the following assembly binding in App.config file:

    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>

    Please refer to the attached sample for implementation. (see C1BindingRedirects.zip)

    Regards,

    Uttkarsh.

  • Posted 7 November 2025, 10:40 am EST

    Hi Charles,

    the easiest way to fix this warning is probably to simply add this line to your csproj file:

    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

    See https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/how-to-enable-and-disable-automatic-binding-redirection

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels