Ignored "bindingredirect" starts working for no apparent reason

0

I have many projects that generate dlls and a main project that generates an executable, today i compiled the projects successfully, but when i tried to start the main project i got for the first time the next exception: "Assembly manifest definition does not match assembly reference", so is not the first time i recompile the projects and exectue the main one without problems, but now i'm getting this error.

After check the exception i could find a "bindingredirect" in the app.config that is causing it, i checked older versions of the system and the thing is that this "bindignredirect" always has existed in the app.config, but this error never was thrown before, if i comment the bindingredirect line the main project starts with no problmes.

All the projects have .net 3.5 as the target .net version, what could cause this? What could have changed so that the bindingredirect now get execute?

App.config section

<!-- Habilita el debug just-in-time. -->
  <system.windows.forms jitDebugging="true" />
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Componentes" publicKeyToken="BB48DC83EB7CD949" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.0.1.17726" newVersion="1.0.1.17261" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

FusionLog of InnerException

=== Información de estado anterior al enlace ===
LOG: Usuario = ymora
LOG: DisplayName = Componentes, Version=1.0.1.17265, Culture=neutral, PublicKeyToken=bb48dc83eb7cd949
 (Fully-specified)
LOG: Appbase = file:///E:/Yerald Mora/Documents/SISTEMAS/Principal/bin/
LOG: PrivatePath inicial = NULL
Ensamblado de llamada : Principal, Version=1.0.1.27092, Culture=neutral, PublicKeyToken=c078d737fbb55d54.
===
LOG: Este enlace empieza en el contexto de carga default.
LOG: Utilización del archivo de configuración de la aplicación: E:\Yerald Mora\Documents\SISTEMAS\Principal\bin\Principal.vshost.exe.config
LOG: Utilizando el archivo de configuración del equipo en C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Redirección detectada en el archivo de configuración de aplicaciones: 1.0.1.17265 se redirigió a 1.0.1.17261.
LOG: Referencia posterior a la directiva: Componentes, Version=1.0.1.17261, Culture=neutral, PublicKeyToken=bb48dc83eb7cd949
LOG: Ya se detectó el mismo enlace, que generó un error hr = 0x80131040.
.net
visual-studio
.net-assembly
app-config
asked on Stack Overflow Mar 31, 2021 by Gerard_93

1 Answer

0

Making tests with the older versions of the system, i realized that the versions numbers for the dll, in the revision number its ever began with a number higher than 17, for example 1.0.1.18463, and that was the problem!..., in the app.config the next line establsih that any version between 0.0.0.0 and 1.0.1.17726 should be redirected to 1.0.1.17261

<bindingRedirect oldVersion="0.0.0.0-1.0.1.17726" newVersion="1.0.1.17261" />

In the FusionLog of the InnerException the next line shows that the dll version 1.0.1.17265 was redirect to 1.0.1.17261

LOG: Redirección detectada en el archivo de configuración de aplicaciones: 1.0.1.17265 se redirigió a 1.0.1.17261.

So when i compiled the project visual studio generated the revision number 17265, this one was in the range stablished in the appconfig, thats the reason due before was working with no problems because the revision number always was out of then range stablished in the property bindingredirect of the appconfig

answered on Stack Overflow Mar 31, 2021 by Gerard_93

User contributions licensed under CC BY-SA 3.0