Visual Studio 2022 - NuGet Package Compatibility implementing .NET 6 and Older Versions
I've been researching this but I tried several approaches but none seem to work... I can't seem to get I'm sure I'm missing something obvious here, but I'm stuck on something that should probably be simple... I'm experiencing issues when trying to restore NuGet packages for a project that targets .NET 6.0 while also maintaining compatibility with .NET Framework 4.8 for another project in the same solution. I keep getting the following behavior message during the build process: ``` NU1107: Version conflict detected for Newtonsoft.Json. Install/reference Newtonsoft.Json 13.0.1 directly to project MyProject to resolve this scenario. ``` I've tried several approaches to solve this. First, I updated the package references in both projects to the latest version of Newtonsoft.Json, which is 13.0.1. However, the .NET Framework project requires version 12.0.3 due to existing dependencies that are not compatible with the newer version. To resolve the conflict, I attempted to use binding redirects in the `app.config` file of the .NET Framework project as follows: ```xml <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-12.0.3.0" newVersion="12.0.3" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> ``` After adding the binding redirect, I still encounter the same behavior. I've also tried cleaning the solution and rebuilding it, and I ensured that the `packages.config` files in both projects are synchronized with the correct versions. I'm unsure how to resolve this without rewriting important portions of the codebase or downgrading dependencies in the .NET 6 project. Any advice on best practices for handling such compatibility issues while keeping both projects functional would be greatly appreciated. This is part of a larger service I'm building. I'm working on a application that needs to handle this. Thanks in advance! For context: I'm using C# on Ubuntu 20.04. I'd really appreciate any guidance on this. This is for a service running on Windows 11. Am I missing something obvious? I'm on Ubuntu 22.04 using the latest version of C#. Thanks for taking the time to read this! For context: I'm using C# on macOS. Cheers for any assistance!