views:

492

answers:

2

Ok I'm coming here as a last resort hoping that someone knows the answer to this, no answers in the newsgroups and I have done everything I know how to do, aside from a serious hack solution that I would love to avoid.

Here is the situation:

I have a .NET class library that is COM exposed. I wrap this into a CAB file and use the Object tag to embed it in the page. On the CODEBASE attribute I point it to the cab file and add a version like so "CODEBASE="cabfiles\mycab.cab#version=30.0.0.1"

The problem:

So because this is a .NET dll exposed to COM it is registering it with an inprocServer32 registry key that is pointing to mscoree.dll with a version of 2.0.50727 which makes sense since .NET com objects run under that process, and 2.0.50727 is the version of that dll. But this is breaking the version property of the CODEBASE attribute on the OBJECT tag.

Any version I set greater that 2.0.50727 will download an reinstall the contents of the cab file.

I have tried changing registry settings and values and a whole slew of things and can't find the solution.

So anyone know of a solution to this problem?

+1  A: 

When your cab is installed you need to update the registry key:

HKCR/CLSID/{GUID}/InstalledVersion/(Default)

  • {GUID} is the Class ID of your object
  • The value is the string specified in your Html element ("30.0.0.1" above).

Windows checks several registry locations prior to resorting to the dll (in your case mscoree.dll). The location above is to install something per-system (HKCR), you can also install it per user. Choose one of the following places to put your version string. Locations are checked in the listed order.

  1. HKCU/CLSID/{GUID}/AvailableVersion/(Default)
  2. HKCR/CLSID/{GUID}/AvailableVersion/(Default)
  3. HKCU/CLSID/{GUID}/InstalledVersion/(Default)
  4. HKCR/CLSID/{GUID}/InstalledVersion/(Default)
  5. Your assembly

It would be nice if regasm took care of this for you, but it doesn't. You'll need to set it manually in your installer.

Mike Haboustak