Migrate VB.Net application from .Net 4.7 to .Net 8

Prat 0 Reputation points
2024-09-05T08:03:19.53+00:00

Hi,

Context:

I have an application where the back-end is written in vb.Net and is running on .Net 4.8. As they are mostly back-end, they are either consol or dlls. Due to the history of the application, the front end is in ms Access! There are a few winforms which, from what I've read, cannot be migrated (My plan is to use a python wrapper for the back-end .Net components /dlls and build a react front-end. Future back-end components will be python). But I have 10s of thousands of lines of VB code which I will not be replacing!

Whilst I have used Visual STudio and .Net for many years as a hobbyist, I by no means have a thorough understanding of how the overly complex environment hangs together.

Challenge:

I would like to upgrade from .Net 4.7 to .Net 8. With the ability to register the dlls so that MS access can integrate with them. As I understand it, this is the only way for MS Access to call components in .Net DLLs.

What I've done to-date:

I was able upgrade all the components using the upgrade extension and get clean compiles. However, I am unable to register the dll's to com.

I even created a new project with one class which did nothing, but could not register it.

I tried registering with regasm (which I used previously for ver 4.7) and kept getting the following error, even with the class which had nothing in it!

MSB3217 Cannot register assembly "DLL name.dll". Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=###########' or one of its dependencies. The system cannot find the file specified.

There are several discussions on this error and none really gave definitive solutions.

Regsrv32 said it was successful, but I couldn't find the registration anywhere!

Most of what I read was relating to C# rather than VB and it seemed that I would have to add additional code for every class (of which there are close to 50!) if I were to get it to work!

Questions:

Is there a definitive description on how I should proceed? Why has Microsoft made it so difficult to simply register a class?

  1. What is the exact procedure to register the DLLs (if that is even possible)?
  2. The registration is purely for the MS Access modules to integrate with them. Is there a way that MS Access can call these classes without COM?

I've spent a week attempting to sort this out with little success. Your assistance on this matter is much appreciated.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,715 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 31,011 Reputation points Microsoft Vendor
    2024-09-05T12:48:02.24+00:00

    Hi @Prat ,

    Migrating from .NET Framework to .NET 8 while retaining MS Access as a front-end introduces challenges, particularly with COM registration for .NET DLLs. .NET Core/5/6/7/8 has no direct support for COM registration like .NET Framework, which leads to issues when using tools like regasm.

    You can manually expose classes to COM by using ComVisible, and export COM interfaces manually. However, this will require a good deal of coding for each class.

    If you want to avoid COM entirely, here are a few alternatives:

    • REST API or Web API: You could expose your .NET 8 logic as a REST API (or use gRPC) and have MS Access consume it via HTTP requests. This modern approach allows you to decouple the two systems and doesn't rely on COM registration.
    • Named Pipes or TCP Sockets: Another inter-process communication method, though more complex to implement, would be to use named pipes or TCP sockets for communication between MS Access and your backend .NET 8 components.

    Best Regards.

    Jiachen Li


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.