We have customers developing custom applications with a .NET API we have
provided. Internally, the API uses COM interop to talk to a legacy COM
interface. The problem is that now we want to upgrade the COM library to the
latest version. Ideally, we would like to do this without requiring the
customers to make changes to their existing applications. I think this is
complicated by the fact that they redistribute the interop DLLs in each of
their applications, but there is a single instance of the COM interface,
registered globally on a given machine.
Our COM interface maintains a fixed set of dispatch IDs that do not change.
Also, we only added methods and/or objects. We did not remove objects or
methods, or change the signatures of the existing methods.
So why do the client apps stop working when we upgrade the COM library? We
don't even get a versioning error. The interop calls just don't do anything.
We are very puzzled.
There are several workarounds that I know of, but none of them are ideal...
1. Make a new interop DLL and recompile the client applications.
2. Add binding redirect info to the client config files to redirect calls
to a new interop DLL
3. Provide a publisher policy file to do the redirect on a system-wide
basis. The problem here is that the client applications redistribute the old
interop DLLs. This complicates things because we have to make sure the
client applications can find the new interop DLL.
We must be missing something. Does anyone have any ideas as to how we can
resolve this, and also how we can avoid these problems in the future?
Thanks so much.
catharticmomentusenet@yahoo.co.uk - 24 Apr 2006 10:18 GMT
This may be related to a problem I am currently investigating. In VS
.NET 2003, after a COM dll is updated, visual studio will automatically
create an updated interop dll next time a build is performed.
However visual studio does not increment the version number of the
interop dll. This means when windows installer looks at upgrading the
interop dll, it sees the version number has not changed, and does
nothing. The user is left with the old interop dll, and their
application crashes.
Chris
catharticmomentusenet@yahoo.co.uk - 24 Apr 2006 10:39 GMT
Ok - I've found the solution to our issue. When the COM component is
changed, you must not only increment the version number in the dll's
resources, but also the type library version number. After that, the
COM component must be re-imported into your .NET project.
Hope this helps.
Chris