Override usage of registered COM assembly

I have an old VB6 application that I'm moving into VB.Net, I also have a COM assembly that is referenced from the application.

I want to be able to run both applications (the old one and the .net one) side by side, the problem is that I made a couple of changes in the signature of the COM assembly for it to work on the .Net application (and these changes aren't compatible with the old app).

If I install the old application first, it registers the dll and copies it into System32, when I install the new application it copies the new COM assembly into its application folder (in program files), but when I execute it, it tries to load the old assembly (registered by the old application).

Is there any way to make the new application use the assembly that is on its own folder? and thus keep the old application using the old one (the one registered that is on system32).

I hope I made myself clear.

Thanks a lot for your help.

Answers


Sound to me you forgot to register the COM server. But that would kill the old app. A hard requirement in COM is that you change the Guids of the co-classes and interfaces when you make breaking changes to them. That ensures that different versions can live side-by-side and not stomp on each other's registry entries.

A reg-free COM manifest would be another way. Although it isn't normally a lot of fun to put the manifest together and troubleshoot problems.

A really, really cheap trick is to put the COM server DLL in the same directory as the client EXE. And create an empty file with the .local filename extension. If the main EXE is named mumble.exe then the file should be named mumble.exe.local. That's enough for the COM resolver to always use the local DLL, not the path that's recorded in the registry. This is documented here.


Can you not give your old and new COM objects distinct GUIDs (CLSIDs), interface names, typelib names and class names (and anything else I've forgotten :))?

i.e. In the new version, rename everything so it doesn't register over the top of the old version as is instead a separate set of objects, interfaces, etc.

The new code could then use the new objects and updated interfaces while the old code can still use the old objects and original interfaces.


Need Your Help

trouble with solving knapsack issue recursively in C

c recursion knapsack-problem

I need to solve the knapsack problem recursively, memoized and with dynamic programming. Currently I'm stuck at the recursive method.

When should I call glEnableClientState() and glDisableClientState() in android

android opengl-es

I just call glEnableClientState() once in onSurfaceCreated() method of GLSurfaceView.Renderer interface. Eg:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.