This article is a mirror article of machine translation, please click here to jump to the original article.

View: 5752|Reply: 3

[Source] [Practical Operation] Conflicts between referring to different versions of DLLs that rely on redirects

[Copy link]
Posted on 2022-10-22 10:03:33 | | | |
Requirements: The project needs to reference many third-party SDKs, and some of them will reference some commonly used DLLs (such as :Newtonsoft.Json.dll), which will cause the whole project to reference different versions of the same DLL, and the project will only output one file with the same DLL compiled results.

Simple DLL version dependency issues can be referenced below:

.net/c# reference dll version conflict resolution
https://www.itsvse.com/thread-4818-1-1.html
Reference:The hyperlink login is visible.

If the referenced DLL is not only of a different version, but also of the publicKeyToken, how should it be solved? In the case of Newtonsoft.Json.dll, the project references a file with a different version and publicKeyToken.



- Newtonsoft.Json.dll,version:12.0.0.0,publicKeyToken:30ad4fe6b2a6aeed
- Newtonsoft.Json.dll,version:4.0.0.0,publicKeyToken:null

A simple reference redirect setting doesn't solve the problem, the configuration is as follows:

When you call a third-party SDK method that depends on Newtonsoft.Json version 4.0.0.0, you will get the following error:

Failed to load the file or assembly "Newtonsoft.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" or one of its dependencies. The found assembly manifest definition does not match the assembly reference. (Exception from HRESULT:0x80131040)
Solution: Create a new JSON4 folder under the bin directory, place the version of Newtonsoft.Json.dll 4.0.0.0 under this folder, and modify the configuration as follows:

(End)





Previous:[Actual combat]. NET/C# implements MySQL database backups based on MySqlBackup.NET
Next:【Practical Combat】Build Thunder Download and DLNA Services for Home Media Docker
Posted on 2022-10-22 12:02:36 |
Learn to learn
Posted on 2022-10-24 10:59:38 |
This trick works, I am bothered by the Newtonsoft.Json.dll of 4.0 and 6.0
Posted on 2022-11-12 13:08:42 |
Learn to learn
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com