How to make bindingRedirect for a DLL project to prevent - warning MSB3247: conflicts detected

I have a DLL project called "Foo" that references Newtonsoft.Json 4.0.7. And I have a second DLL project called "Bar", referencing "Foo" and referencing Newtonsoft.Json 4.0.5. And for various reasons its impossible to change the version of Newtonsoft.Json of both.

When I compile this, I get this warning in the Bar project:

warning MSB3247: Conflicts between different versions of the same dependent assembly were detected.

So, I created app.config in the "Bar" of the project:

<dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/> <bindingRedirect oldVersion="0.0.0-4.0.7" newVersion="4.0.5"/> </dependentAssembly> 

But that did not stop the warning.

An interesting point is that when I change the project "Bar" from the DLL to the console, the warning disappears. Therefore, I assume that redirection only works for executable files.

How can I get rid of this warning in my script?

+4
source share
2 answers

Do you need access to different versions of NewtonSoft.Json dll? Not? Remove the block from the configs, and everything works fine.

0
source

There may be different cases for this error. I received the message MSB3247 and solved the problem of reloading the excluded DLL project into my solution. The project had a link to the excluded DLL, but there are former compiled versions of the DLL, perhaps this caused a problem - in any case, it now works again (- :: I hope this helps

0
source

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


All Articles