Showing results for 
Search instead for 
Did you mean: 

Register for COM interop in VB 2008 express

Valued Contributor
Valued Contributor




I'm trying to create a SE addin using VB 2008 express edition. I am using the SE '.NET programmers guide - Chapter 12 Addins' as a reference. I don't get very far before being stumped. There is no 'Register for COM interop' in the compile tab of the project properties dialogue. I understand from some google searches that I have done that this feature is not a part of VB 2008 express. Can anyone suggest a workaround other than buying a real copy of VB 2008.



Posted by: Dan Lanigan
Post date: 2/1/2010 11:02:48 AM


RE: Register for COM interop in VB 2008 express

Valued Contributor
Valued Contributor


You can run regasm.exe on your DLL. In fact, you might want to create a reg file using regasm.exe like this:

regasm.exe /regfile:myaddin.reg /codebase myaddin.dll

That will generate a .reg file. You can then double-click the file to add the data to the registry (or import it into the registry). However on a 64 bit OS, the windows explorer is 64 bit and the data will be added to the 64 bit registry hive. If edge is 64 bit, no problem. If edge is 32 bit, edge won't "see" the addin.

So I keep a regedt32.exe shortcut on my desktop (from the Windows\SysWOW64 directory) and I drag&drop the .reg file on it to get the entries added to the Wow6432Node registry hive(s).

You can also edit the .reg file and replace HKEY_CLASSES_ROOT with HKEY_CLASSES_ROOT\Wow6432Node. Then double-clicking from explorer should add the entries to the 32 bit registry hive.

You can also create a bat file that compiles and registers that you can run from the VS 2005 command prompt or explorer window. Now thanks to Microsoft, if you have the 2005 command prompt tool (ships with VS 2005 - I don't know about "express edition") the regasm.exe is available (type "where regasm" in the prompt window) in the "Visual Studio" environment. And thanks to Microsoft, if you have VS 2008, it is not! But with 2005, you can do something like this in a .bat file:






@call vsvars32.bat


Vbc.exe /noconfig /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Data,System.Diagnostics /nowarn:42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 /rootnamespaceSmiley FrustratedEAddIn /win32Resource:resTempl1.res /docSmiley Surprisedbj\Release\SEAddIn.xml /define:"CONFIG=\"Release\",TRACE=-1,_MyType=\"Windows\",PLATFORM=\"AnyCPU\"" /referenceSmiley Very Happy:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll,D:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll,D:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll,D:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll,D:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll,obj\Release\Interop.SolidEdgeConstants.dll,obj\Release\Interop.SolidEdgeFramework.dll /debugSmiley Tonguedbonly /optimize+ /outSmiley Surprisedbj\Release\SEAddIn.dll /resourceSmiley Surprisedbj\Release\SEAddIn.Dialog1.resources /resourceSmiley Surprisedbj\Release\SEAddIn.EdgeBarForm.resources /resourceSmiley Surprisedbj\Release\SEAddIn.Resources.resources /target:library *.vb "My Project\AssemblyInfo.vb" "My Project\Application.Designer.vb" "My Project\Resources.Designer.vb" "My Project\Settings.Designer.vb"

regasm.exe /codebase obj\Release\SEAddIn.dll

Vbc.exe /noconfig /win32Resource:resTempl1.res /define:"CONFIG=\"Debug\",DEBUG=-1,TRACE=-1,_MyType=\"Windows\"" /referenceSmiley Very Happy:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll,D:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll,D:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll,D:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll,D:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /outSmiley Surprisedbj\Release\SEAddInRes.dll /target:library resproxy.vb

copy obj\Release\SEAddInRes.dll bin\Release\SEAddInRes.dll


ECHO Compile Complete


Now your compile line won't be the same as the above. But no problem if "express" is like VB .NET. Just get a clean build. The output window will contain that giant "Vbc.exe" line above. Replace mine with yours in the bat file and you should be able to build from any prompt or by double clicking the bat file.

I uploaded a sample VB.NET add-in today for another post and the zip file has a number of bat files (one for each build config - x86, x64 and "Any CPU". There is also a readme.txt file that gives lots of nauseating details about how VB .NET does it's best to thwrat your every attempt to get a good addin together.

One other note, if your project doesn't have a GUID attribute, VB .NET likes to assign a new CLSID/GUID to your object each time you build. That means generating the .reg file using regasm /regfile would have to be performed each time you build the add-in. VB 6 used to have a "binary compatible" checkbox under "Component" on the properties page to keep that from occurring. I never found the equivalent in VB .NET.


Posted by: R.D. Holland
Post date: 2/3/2010 8:22:57 AM

RE: Register for COM interop in VB 2008 express

Valued Contributor
Valued Contributor


Wow, thanks.

I wasn't expecting such a well thought out and involved response, so thank you.

Given my beginner status wrt SE addins I will have to go through what you have said slowly and absord what I can. I'll also read up on the other thread that you mentioned



Posted by: Dan Lanigan
Post date: 2/4/2010 11:27:37 AM