Com Interop not working when com dll has a version change (interface probs)

I have some software which references a 3rd party com dll. In Visual Studio 2003 i have added the reference to the dll, and it automatically created all the needed interops (which all runs fine).

My problem occurs when the 3rd party software has a new patch and the com dll i reference has a version change. The method calls i use are all the same. When my software is run i recieve the following error on every version change:

"Unable to cast COM object of type 'QSR.Scl' to interface type "QSR._Scl". This operation failed because the QueryInterface call on the COM Component for the interface with IID '{A3DD....' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."
(note i shortend the IID for the post)

At the moment to resolve this, i have to do a complete rebuild of my project so new interops are created referencing the new version of the com dll. This is becoming a managment problem as there are multiple installing using different versions and they cant have any downtime.

Is there a way to allow the interops to work without having to rebuild the project? Am i able to recreate them using tlbimp.exe on the install machine?

Any help is appreciated

Adam

[1285 byte] By [Atroa] at [2007-12-24]
# 1

im not entirely sure but I do know that you have to update the application as remember, whenever there is an update, some features will be removed, some will be added so you are facing in a sense a version problem - that one is newer and may have some items removed from it....so when you try to access it using the "old" one, you can't as it doesnt exist in the new one.

Just thought I would put in my 2 cents but there may well be a way, I am not sure :-)

you have to realize that there will be an eventual downtime - Microsoft website has a down time at least, so does mine, so do these forums - pretty much anything has to have an eventual downtime for maintainence or upgrade.... :-)

ahmedilyas at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 2

Sounds like the com dll has to be re- registered.

Link shows a way to do this dynamically.

http://www.msjogren.net/dotnet/eng/samples/dotnet_dynpinvoke.asp

cablehead at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 3
cablehead wrote:

Sounds like the com dll has to be re- registered.

Link shows a way to do this dynamically.

http://www.msjogren.net/dotnet/eng/samples/dotnet_dynpinvoke.asp

Do u mean the 3rd party com dll im using needs to be reregistered?

One thing in testing i have found is if i rebuild the project, and copy the new interop dll over to the client machine it all works fine. (no registering of my or the 3rd party dll was needed).

Atroa at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 4

Yea..Your project knows that the dll is not the same...so it rebuilds the interop...probably a security issue.

I would try registering the new dll before loading the proj.

If it works...still won't be any fun....

cablehead at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...