HighTechTalks DotNet Forums  

Problem installing new assembly; old one still being sought

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Problem installing new assembly; old one still being sought in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
msorens
 
Posts: n/a

Default Problem installing new assembly; old one still being sought - 06-22-2009 , 06:10 PM






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?

Reply With Quote
  #2  
Old   
Jialiang Ge [MSFT]
 
Posts: n/a

Default RE: Problem installing new assembly; old one still being sought - 06-23-2009 , 07:21 AM






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:
msdnmg (AT) microsoft (DOT) com.

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

Reply With Quote
  #3  
Old   
msorens
 
Posts: n/a

Default RE: Problem installing new assembly; old one still being sought - 06-23-2009 , 01:01 PM



Per your suggestion I searched the registry and found a dozen entries under
HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocSe rver32 for each of the last
dozen versions I have installed. This includes these among others:

HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocSe rver32\2009.5.28.1
HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocSe rver32\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?

Reply With Quote
  #4  
Old   
Wilson, Phil
 
Posts: n/a

Default Re: Problem installing new assembly; old one still being sought - 06-23-2009 , 07:21 PM



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

"msorens" <m_j_sorens (AT) newsgroup (DOT) nospam> wrote

Quote:
Per your suggestion I searched the registry and found a dozen entries
under
HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocSe rver32 for each of the
last
dozen versions I have installed. This includes these among others:

HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocSe rver32\2009.5.28.1
HKLM\Software\Classes\CLSID\{804FE2E0...}\InprocSe rver32\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?

Reply With Quote
  #5  
Old   
msorens
 
Posts: n/a

Default Re: Problem installing new assembly; old one still being sought - 06-24-2009 , 09:40 AM



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.

Reply With Quote
  #6  
Old   
Wilson, Phil
 
Posts: n/a

Default Re: Problem installing new assembly; old one still being sought - 06-24-2009 , 11:42 AM



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


"msorens" <m_j_sorens (AT) newsgroup (DOT) nospam> wrote

Quote:
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.

Reply With Quote
  #7  
Old   
msorens
 
Posts: n/a

Default Re: Problem installing new assembly; old one still being sought - 06-24-2009 , 01:14 PM



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')

Reply With Quote
  #8  
Old   
Wilson, Phil
 
Posts: n/a

Default Re: Problem installing new assembly; old one still being sought - 06-25-2009 , 12:41 PM



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


"msorens" <m_j_sorens (AT) newsgroup (DOT) nospam> wrote

Quote:
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')

Reply With Quote
  #9  
Old   
Jialiang Ge [MSFT]
 
Posts: n/a

Default Re: Problem installing new assembly; old one still being sought - 06-25-2009 , 10:10 PM



Dear Sir

Sorry for my delayed response.

Quote:
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?
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:
msdnmg (AT) microsoft (DOT) com.

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

Reply With Quote
  #10  
Old   
msorens
 
Posts: n/a

Default Re: Problem installing new assembly; old one still being sought - 06-29-2009 , 12:17 PM



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?

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.