Forwarding Forwarding for C # Library

I have a C # library that requires binding redirects. The library itself refers to the executable, and I put the redirection in the configuration file that this executable will use:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MyAssembly" publicKeyToken="null" culture="neutral"/>
        <bindingRedirect oldVersion="0.1" newVersion="0.2"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

The exe works absolutely fine and reads the redirect. The problem is that the compiler generates a warning (conflicting build), because during compilation the library does not look at the configuration file and therefore does not know about binding redirection.

Sorry, I have no alerts in my domain. Any ideas on how this might be suppressed? Or how can I “make” my library know about redirection?

The warning is of type MSB3277.

+4
3

, , EXE .

,

, , MSBuild, .

MSB3277

, , , , . , , . "" > "" > " " > " " > " MSBuild" > "".

"" > "", "". , - :

"foobar, Version = 1.42.0.0, Culture = neutral, PublicKeyToken =" null "" foobar, Version = 1.666.0.0, Culture = neutral, PublicKeyToken = "null".

"foobar, Version = 1.42.0.0, Culture = neutral, PublicKeyToken =" null " , " foobar, Version = 1.666.0.0, Culture = neutral, PublicKeyToken = "null" .

- , , , , , , , , -.


, , , , . , GAC, DLL , . .

MSBuild , " ", . , , - , , . , <bindingRedirect> . .

- , , . , , , , . , Nuget. . , ( , ), , , .

+5

msbuild, , , ?

, AsmSpy.

+2

Try CopyLocal = true and check the configuration of a specific version.

0
source

Source: https://habr.com/ru/post/1612908/


All Articles