'NET core - Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ', .NET 6

I have converted .NET Framework 3.5 TestAPP to .NET 6 TestAPP and worked well. i have an Automation project(C++ project) which was using .NET Framework 3.5 TestAPP.dll to run the tests, but right now i have replaced the .NET Framework 3.5 .dll with .NET 6 TestAPP i.e. TestAPP.dll when i ran the exe in command line , i have got an error as

"Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

Please let me know if anything needs to be corrected.



Solution 1:[1]

Resolved the error by changing the C++/CLI properties from visual studio project properties , which was referring to .NET framework earlier and i have changed the property as .NET core runtime(clr:netcore) and it is internally handled all GAC changes and worked well. Hope it might help someone . enter image description here

Solution 2:[2]

The running project returned this error. When I changed it to the way in the image, the error was solved.

Project>Properties

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MSG
Solution 2