Installer Project, Registry and Regasm
-
I have a COM object built in C#. Its a an IE deskband. It implements the following method:
[ComRegisterFunctionAttribute] public static void Register( Type t )
Which gets called when regasm is used and it makes teh appropriate entries into the registry. Works great. Now I am trying to build a installer for this using VS 2005. I did the following: 1. I added all assemblies to the GAC 2. I marked my dll as Regsiter vsdrpCOM in the property window. The install works but my tool bar does not show up in IE. The I tried the following: 1. I added all assemblies to the GAC 2. I added my dll to the prgram folder in addition to the GAC. 3. I marked my dll (the program folder one) as Regsiter vsdrpCOM in the property window. Install works with no errors but toolbar does not show up in IE. BUT, now if I use the commandline and regasm my dll (program folder one), bingo... everything works. What do I have to do in the installer project to make this work. I know the installer lets you make registry entries, but I do not wish to do that. Its what the[ComRegisterFunctionAttribute] public static void Register( Type t )
is meant for. My first hunch was that regasm was not working. On further inspection I realized that regasm was working but not completely. My Register Method does the following:if( 0 != ( style & BandObjectStyle.Vertical ) ) rkCat.CreateSubKey( "{00021493-0000-0000-C000-000000000046}" ); if( 0 != ( style & BandObjectStyle.Horizontal ) ) rkCat.CreateSubKey( "{00021494-0000-0000-C000-000000000046}" ); if( 0 != ( style & BandObjectStyle.TaskbarToolBar ) ) rkCat.CreateSubKey( "{00021492-0000-0000-C000-000000000046}" ); if( 0 != ( style & BandObjectStyle.ExplorerToolbar ) ) Registry.LocalMachine.CreateSubKey( @"SOFTWARE\Microsoft\Internet Explorer\Toolbar" ).SetValue( guid, name );
On inspecting the registry after installation I notice that all entries but the last one are in the registry. So whats going on? A manual regasm works for all of the above, an installer based one does not. -
I have a COM object built in C#. Its a an IE deskband. It implements the following method:
[ComRegisterFunctionAttribute] public static void Register( Type t )
Which gets called when regasm is used and it makes teh appropriate entries into the registry. Works great. Now I am trying to build a installer for this using VS 2005. I did the following: 1. I added all assemblies to the GAC 2. I marked my dll as Regsiter vsdrpCOM in the property window. The install works but my tool bar does not show up in IE. The I tried the following: 1. I added all assemblies to the GAC 2. I added my dll to the prgram folder in addition to the GAC. 3. I marked my dll (the program folder one) as Regsiter vsdrpCOM in the property window. Install works with no errors but toolbar does not show up in IE. BUT, now if I use the commandline and regasm my dll (program folder one), bingo... everything works. What do I have to do in the installer project to make this work. I know the installer lets you make registry entries, but I do not wish to do that. Its what the[ComRegisterFunctionAttribute] public static void Register( Type t )
is meant for. My first hunch was that regasm was not working. On further inspection I realized that regasm was working but not completely. My Register Method does the following:if( 0 != ( style & BandObjectStyle.Vertical ) ) rkCat.CreateSubKey( "{00021493-0000-0000-C000-000000000046}" ); if( 0 != ( style & BandObjectStyle.Horizontal ) ) rkCat.CreateSubKey( "{00021494-0000-0000-C000-000000000046}" ); if( 0 != ( style & BandObjectStyle.TaskbarToolBar ) ) rkCat.CreateSubKey( "{00021492-0000-0000-C000-000000000046}" ); if( 0 != ( style & BandObjectStyle.ExplorerToolbar ) ) Registry.LocalMachine.CreateSubKey( @"SOFTWARE\Microsoft\Internet Explorer\Toolbar" ).SetValue( guid, name );
On inspecting the registry after installation I notice that all entries but the last one are in the registry. So whats going on? A manual regasm works for all of the above, an installer based one does not.I should reply to my own post. I found the answer to this long ago, but never came back to update this. So here goes. Regasm comes with Visual Studio. So a machine with no visual studio and just the .Net framework will NOT have regasm on it. Hence, you cannot rely on [ComRegisterFunctionAttribute] public static void Register( Type t ) For this is called by regasm. You need to find other ways to register your DLL and make otehr registry entries.