I'm making a COM using VS2019 and Visual Basic. I'm very new to Visual Studio.Net
The COM needs to be referenced in one of the VB5.dll's in a very large VB5 program.
I've managed to get the .TLB from a test .Net program to register in a test VB5 program.
Next I had to get Restsharp and Newtonsoft.Json to talk to an internet API that I need to address in test mode.
To get the whole package to work on the development system, make it a COM, make Restsharp work and make Newtonsoft.Json work, I had to use NET Framework 2.0., Class Library, make sure Register for COM interop was checked, Restsharp.Net2 and Newtonsoft.Json.13.0.
After I set a reference to my test .NET called ClassLibrary2 and ran my VB5 program, I first called a function ClassLibrary2.ComClass1.MyFunction which just passes back the integer 100. It worked.
Next I called a function ClassLibrary2.CustomerTools.GetCustomer and passed it a customer ID. In the .Net program, this required a "Dim client As New RestSharp.RestClient With....", then "Dim request As New RestRequest(Method.GET)", then a couple more RestSharp procedures, finally "IQProresponse = JsonConvert.DeserializeObject(Of Rootobject)(response.Content)", this obviously requires JsonConvert to work to convert Json to a structure I defined.
When the last line is handled it generates this error:
Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
I cannot find Newtonsoft.Json, Version=4.5.0.0 in NuGet. With an internet search I find a redirect which seems to reference C# files. I did find this in app.config.
<?xml version="1.0" encoding="utf-8"?>
<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-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
which I changed to
<?xml version="1.0" encoding="utf-8"?>
<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-4.5.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
It didn't help. Then I found several references to 13.0.0.0 in the name of files or inside some files. I don't think renaming files will fix the problem.
Any advice???