0

It's my 1st time trying to build a .DLL in .Net, for use with a VB5 program...I'm a newbee

Windows 10, VS 2019, VB, building a Class Library Target framework is .NET Core 3.1. RestSharp 106.15.0 in Assemblies, Newtonsoft.Json 13.0.1 getting error

"C:\Users\User\Desktop\PSMdata\aaaOther>regasm.exe IQProLnk.dll /tlb:IQProLnk.tlb Microsoft .NET Framework Assembly Registration Utility version 4.8.4084.0 for Microsoft .NET Framework version 4.8.4084.0 RegAsm : error RA0000 : Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."

I've looked at everything I could find doing a Google search. I've tried adding a System.Runtime through NuGet, but all I could find is 4.3.1.... it still wants 4.2.2.0

As suggested by someone who did a C# program and had the same problem, I've added (to no avail):

<dependentAssembly>
  <assemblyIdentity name="System.Runtime" publicKeyToken= "b03f5f7f11d50a3a" culture="neutral"/>
  <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>

to "C:\Users<user>\AppData\Local\Microsoft\VisualStudio\16.0_cd2f1afe\devenv.exe.config"

Some one suggested "modify the app.config entry to match packages.config for the newVersion", but I cannot find either one of those config files. But this was for VS 2017 anyhow.

I've searched all the files in the IQProLnk subdirectories for any reference to System.Runtime and all I found was this in the IQProLnk.vbproj file after I added System.Runtime in NuGet

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
    <PackageReference Include="System.Runtime" Version="4.3.1" />
  </ItemGroup>

Otherwise I don't know what it is that wants v4.2.2.0.

I hope I haven't been to verbose but did give enough information.

Thanks

RichG
  • 1
  • 2
  • I created a new Class called ClassLibrary1 that only returns the addition or multiplication of two integers. It produces the same error when using RegAsm against it. Since it was so simple I was able to locate the call for System.Runtime 4.2.2.0. Under Dependencies, Frameworks is Microsoft.NETCore.App, under that is a list of what it seems to want. One of the items in that list is System.Runtime. When I look at the properties it shows Assembly Version 4.2.2.0. It does not allow me to change that. SO I need to change Microsoft.NETCore.App. Is that associated with .NET Core 3.1??? – RichG Apr 26 '22 at 02:53
  • This is supposed to fail, [ComVisible] assemblies written in .NETCore are registered [with regsvr32.exe](https://stackoverflow.com/a/57646516/17034), not regasm.exe. A significant problem in .NETCore is that it has no support for generating a type library (no /tlb option), that's typically where the attempt to migrate to .NETCore dies. – Hans Passant Apr 26 '22 at 09:11
  • Thank you Hans. I don't get to work on this much so the development is slow. A couple of months ago, while I knew nothing about what I was doing, I did create a .dll using VS2019, that registered in a test program built with VB5. So, I put that away and focused on getting VS2019 and RestSharp to communicate with an API I need to use. I got the API communication working along with the deserialization of the returned JSON string, but the packaged developed will not register with the VB5 program now. So, I'm trying to backup and figure out what I did differently a couple of months ago. – RichG Apr 28 '22 at 17:17

0 Answers0