Regasm Installing - double registration necessary? | Unregister problem

Mar 1, 2015 at 9:04 AM
TL;DR:
  1. Why is it necessary to install via .REG-File and without (BOTH) when using regasm?
  2. Do I need to specify "/codebase" when I use "/unregister" when installed via "/codbase"?
Registration via Regasm finally works and the extension works fine but install/uninstall bothers me still...

Hope to get some information and could share the code if wanted - German, though.

Hello there,

I (Windows 7 64 bit, SharpShell v4, VS2013CE) recently found this and wanted to create an extension for the Status Bar (I wanted to see the size of folders there).

So I tested it with a Prototype -
using SharpShell.Attributes;
using SharpShell.SharpInfoTipHandler;
using System.Runtime.InteropServices;

namespace C0.Windows.Explorer.Opp
{
    /// <summary>
    /// PROTOTYPE {SharpInfoTipHandler}.
    /// PaR, 28. Februar 2015 @ C0 | VS-Villingen.
    /// </summary>
    [COMServerAssociation(AssociationType.Directory)]
    [ComVisible(true)]
    public class Protoype2 : SharpInfoTipHandler
    {
        protected override string GetInfo(RequestedInfoType infoType, bool singleLine)
        {
            return "Prototype2";
        }
    }
}
It's a "AnyCPU", "Debug", ComVisible, Signed (SNK) DLL.

Then I had to register using regasm.
I created some batch-files:
1: Registration using Regasm with Codebase-Info
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe" %~dp0%C0.Windows.Explorer.Opp.dll" /codebase
2: Creating of Regfile for above:
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe" %~dp0%C0.Windows.Explorer.Opp.dll" /codebase /regfile
3: Uninstall
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe" %~dp0%C0.Windows.Explorer.Opp.dll" /unregister
(I executed every bat as administrator)

I built the project, went to "Debug"-Folder and ran the second (.REG) bat:
-> No luck here. Registry shows that everything went OK and all entries are set but the extension is not working.

Then I uninstalled and tried the first (regasm) bat:
-> No luck either... It even created the HKEY_CLASSES_ROOT\Directory\shellex{00021500-0000-0000-C000-000000000046} entry (.REG-File-Bat did not)

So I uninstalled again... Every Registry-Entry was deleted (looked for CLSID, "Prototype2" and Folder/Namespaces, Nothing!)

...

Finally it worked: I first installed via first bat and THEN executed the .REG-File from the second bat -> It now works.

Why? And when I now try to uninstall, the CLSID entry does not get removed from some part of the registry?

After uninstall I can install it everywhere again (just the first batch-file) and it works! (No .REG-File needed)... Sure, the entry in the registry did not get deleted (-> BOTHERS )

For my understanding: "regasm <DLL>" and "regasm <DLL> /regfile" should do exactly the same thing - only that with "/regfile" it saves the result for later use... (Am I wrong?)

-> What does ShellSharp do? How does it get registered or rather, what does it different than the .REG-File when using Regasm directly? (The extra entry comes from SharpShell?)

By the way, do I need to use "/codebase" in my uninstall-batch when registered via "/codbase"?

Thought it would not matter.

Some more Information:

Properties:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("C0.Windows.Explorer.Opp.Prototype")]
[assembly: AssemblyDescription("Prototyp für C0.Windows.Explorer.Opp")]
[assembly: AssemblyConfiguration("debug")]
[assembly: AssemblyCompany("C0 Villingen-Schwenningen, Deutschland")]
[assembly: AssemblyProduct("C0.Windows.Explorer.Opp.Prototype")]
[assembly: AssemblyCopyright("Copyright © C0 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
// Wichtig: Sonst werden alle öffentlichen Klassen ComVisible!
[assembly: ComVisible(true)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("791f81ff-2c75-47c0-9f33-a692c6f1d036")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Registry:

HKEY_CLASSES_ROOT\C0.Windows.Explorer.Opp.Prototype2
-> CLSID

HKEY_CLASSES_ROOT\CLSID\<CLSID>
->This Entry stays after uninstallation (ONLY if installed via both batch-files)
-> Information are the same as always...

HKEY_CLASSES_ROOT\Directory\shellex{00021500-0000-0000-C000-000000000046}
-> The CLSID from above is only here after installing with the first batch-file (without /regfile)

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\C0.Windows.Explorer.Opp.Prototyp2
-> CLSID same

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Cached
-> Name: {6A13D23B-3619-30D7-B239-F0F42585EB67} {00021500-0000-0000-C000-000000000046} 0xFFFF
-> Value: 01 00 00 00 00 00 00 00 EB A2 B3 ED 7F 53 D0 01
-> Only there if installed via second batch-file (with /regfile, executed .REG)
--> No change when deleted manually (still works fine)