1
Vote

An extra "CodeBase" registry value for COM Addin

description

When I use NetOffice to creates an Excel COM Addin whose assembly version is not 1.0.0.0 and register it using RegAsm.exe with /codebase option, an extra "CodeBase" registry value is created under a (non-exisitng) assembly version 1.0.0.0. When unregistering it using RegAsm /unregister, the registry entries for the version 1.0.0.0 is left unremoved in the registry.

RegAsm creates a set of correct registry entries for the Assembly's correct version, as well as an extra entry for 1.0.0.0, so the registered COM Addin works. Also, unremoved registry entries do nothing critical (except for slightly wasting the registry.) So, this is a relatively minor issue.

REPRODUCTION STEPS
  1. Run NetOffice Developer Toolbox, choose VS Project Wizard, then create an Automation Addin project for Excel. (Leave other options as their default.)
  2. Open the generated project with Visual Studio.
  3. Open the property page for MyAssembly project, choose Application tab, click on Assembly Information..., then change the Assembly version to, say, 1.2.3.4.
  4. On Build tab, uncheck "Register for COM interop" so that VS doesn't update the registry.
  5. Build the solution to create MyAssembly.dll.
  6. Open an Administrator Command Prompt, cd to the directory where MyAssembly.dll resides, and run regasm MyAssembly.dll /codebase
  7. Run RegEdit and examine the entries below the COM Addin's CLSID.
OBSERVED BEHAVIOUR

Below the InprocServer32 registry key, I see two subkeys: 1.0.0.0 and 1.2.3.4. Below 1.0.0.0 there is a registry value "CodeBase". (Registry values below 1.2.3.4 are fine, BTW.)

See the attached .reg file for details. Lines 18 and 19 are unwanted. (I'm on 64 bit Windows and developing a 32 bit addin, so the registry keys are below Wow6432Node.)

EXPECTED BEHAVIOUR

Below the InprocServer32 registry key, I see only one subkey 1.2.3.4.

GUESSED CAUSE

NetOffice.ExcelApi.Tools.COMAddin.RegisterFunction(Type) contains a code to add a "CodeBase", which I suspect is misbehaving. (Although I'm not sure it is really the cause of the issue nor what is the intended purpose of the code...)

ENVIRONMENT

Windows 7 (64 bit), .NET Framework 4.0, Visual Studio 2013 Express, NetOffice 1.6, Toolbox 1.2.

file attachments

comments

SebastianDotNet wrote Sep 25, 2014 at 11:23 PM

sry for the delay. (i do NetOffice in my free time)[0A][0A]It's true, the toolbox does some mistakes for the reg code.[0A]Thx for pointing this out. I suggest you to use NO 1.7 and start from the examples.[0A]The next toolbox version comes with NO 1.8 (and includes a visual ribbon designer and its totaly new developed)[0A][0A]BTW: It looks like you have much experience and you are an expert developer. for this reason, please contact me in my private skype account if you want: public.sebastian . give me a hint to this discussion in your contact agreement(otherwise, its ignored).[0A][0A]*Sebastian