Discussion:
Problem installing new assembly; old one still being sought
(too old to reply)
msorens
2009-06-22 23:10:02 UTC
Permalink
I am calling a .NET application via a COM interface from Ruby. This has
worked fine for a long time with this simple installation procedure:

(1) Compile project on development machine.
Then on target machine:
(2) Remove existing version of dll from \Windows\Assembly.
(2) Drag-and-drop dll file to \Windows\Assembly.
(3) Run "Regasm.exe MyObj.dll /tlb:MyObj.tlb".
(4) Check with this test program:
------------------------------
require 'win32ole'
my_driver = WIN32OLE.new('MyObj.MyClass')
------------------------------

I have repeated this procedure on the same target machine frequently.
Usually I will increment the file and assembly version numbers before I
compile a fresh dll. The only thing unique about this time--when the
procedure failed--is that I am attempting to use an older version of the dll
(that is, I am trying to load version 2009.5.29.1 after I have had
2009.6.19.4 successfully installed).

The error on the command line is this:
failed to create WIN32OLE object...
HRESULT error code:0x80070002
The system cannot find the specified file.

The Assembly Binding Log Viewer (fuslogvw) reveals why this is occurring:
the system is trying to load the newer version (2009.6.19.4). It thus reports
the GAC lookup is unsuccesful, since I now have version 2009.5.29.1 in the
GAC.

I thought that if I remove it from the GAC (deleting from \Windows\Assembly)
and re-execute regasm, all traces of the previously installed version should
be gone. So where else does it know about the previous version from and how
do I properly clean up when I do a new install?
Jialiang Ge [MSFT]
2009-06-23 12:21:27 UTC
Permalink
Hello

The version info is also in the CLSID registry of the COM component. You
can search in regedit for the CLSID of MyObj.MyClass, locate its CLSID key,
and see whether there are the version info of the assembly below the key.

Regards,
Jialiang Ge
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
***@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
msorens
2009-06-23 18:01:02 UTC
Permalink
Per your suggestion I searched the registry and found a dozen entries under
HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocServer32 for each of the last
dozen versions I have installed. This includes these among others:

HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocServer32\2009.5.28.1
HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocServer32\2009.6.19.4

How does the system decide which one to use? Does it always take the highest
version number? If so, could I safely just delete any of the entries for
version numbers that are higher than the one I want? Or should I just delete
the entire HKLM\Software\Classes\CLSID\{804FE2E0...} subtree then re-install
the one I want into the GAC?
Wilson, Phil
2009-06-24 00:21:40 UTC
Permalink
Isn't there a generic non-versioned InpocServer32 entry? IIRC, this generic
one is what gets used by default and the others can be used if your client
program uses a manifest, and although it seems odd a Win32 clienbt can use a
manifest to redirect to a specifiv version.
--
Phil Wilson
The Definitive Guide to Windows Installer

http://www.apress.com/book/view/1590592972
Post by msorens
Per your suggestion I searched the registry and found a dozen entries under
HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocServer32 for each of the last
HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocServer32\2009.5.28.1
HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocServer32\2009.6.19.4
How does the system decide which one to use? Does it always take the highest
version number? If so, could I safely just delete any of the entries for
version numbers that are higher than the one I want? Or should I just delete
the entire HKLM\Software\Classes\CLSID\{804FE2E0...} subtree then re-install
the one I want into the GAC?
msorens
2009-06-24 14:40:08 UTC
Permalink
There does seem to be a base InprocServer32/Assembly entry but that shows the
version number of the latest one installed (2009.5.28.1), which is *not* the
one being used.
Wilson, Phil
2009-06-24 16:42:27 UTC
Permalink
If you are accessing it via Progid, then I suspect that the Progid is
referring to the one you don't want.
--
Phil Wilson
The Definitive Guide to Windows Installer
http://www.apress.com/book/view/1590592972
Post by msorens
There does seem to be a base InprocServer32/Assembly entry but that shows the
version number of the latest one installed (2009.5.28.1), which is *not* the
one being used.
msorens
2009-06-24 18:14:01 UTC
Permalink
I am not sure how one would access by Progid. :-)

I am accessing it simply by name, as I indicated in my original post--in ruby:

my_driver = WIN32OLE.new('MyObj.MyClass')
Wilson, Phil
2009-06-25 17:41:42 UTC
Permalink
MyObj.MyClass looks like a ProgId to me. What's in HKCR\MyObj.MyClass? A
CLSID?
--
Phil Wilson
The Definitive Guide to Windows Installer
http://www.apress.com/book/view/1590592972
Post by msorens
I am not sure how one would access by Progid. :-)
my_driver = WIN32OLE.new('MyObj.MyClass')
Jialiang Ge [MSFT]
2009-06-26 03:10:30 UTC
Permalink
Dear Sir

Sorry for my delayed response.
Post by msorens
How does the system decide which one to use? Does it always take the
highest version number? If so, could I safely just delete any of the
entries
Post by msorens
for version numbers that are higher than the one I want? Or should I just
delete the entire HKLM\Software\Classes\CLSID\{804FE2E0...} subtree
then re-install the one I want into the GAC?
Your understanding is right. The system always takes the highest version
number, regardless of the setting in the base InprocServer32/Assembly
entry. You can first backup the CLSID registry key in case that you would
like to use the higher versions in future, then safely delete the version
numbers that are higher than the one you want.

The best practice of uninstalling a version of COM written in .NET language
is to first unregister it using the command

regasm /u <assembly>

Then remove it from the GAC. This makes sure that the registry nodes of the
version is cleared and it will not interfere with your future setup of
other versions of the COM component.

If you have any other questions or concerns, please feel free to tell me.

Best Regards,
Jialiang Ge
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
***@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
msorens
2009-06-29 17:17:01 UTC
Permalink
Jialiang Ge:
Xie xie! Thank you for confirming the details--I deleted the later version
numbers from the registry and then the correct version was accessed.

One follow-up question: you indicate that one should unregister an assembly
with regasm. I have only seen examples with regasm using a simple assembly
name. How do I fully specify an assembly (i.e. name and version) so "regasm
/u" deletes just a specific version?
Jialiang Ge [MSFT]
2009-06-30 12:33:29 UTC
Permalink
Dear Sir

Regasm does not support using strong name to specify the assembly. If the
assembly file is still available to you, you can run regasm /u directly
upon the file. Otherwise, you would need to first find out the assembly
file in the GAC directory, for example
C:\windows\assembly\gac_msil\csdllcomserver\1.0.0.0__f973e70f8ab8b804\csdllc
omserver.dll, then run regasm /u upon it.

If you have any other questions or concerns, please feel free to tell me.

Regards,
Jialiang Ge (***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
***@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

Loading...