How do I create an install for a custom SolidWorks addin?

May 13, 2008 3 Replies

I created an addin using Visual Studio 2005. How do I create an install so all users will have the addin added to SolidWorks and have the addin enabled by default?


Official answer is too long to give here. Quick answer: Create a simple text file called Register.reg containing the following text:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Solidworks\AddInsStartup\{GUID of your application}] @=3Ddword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\Addins\{GUID of your application}] @=3Ddword:00000000 "Description"=3D"Addin description" "Title"=3D"Addin Title"

Now create a simple text file called Register.bat in the same folder as the addin dll. Add the following line: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm /codebase addindllname.dll

On each client, double click those 2 files to install the addin.

Usually I generate the text for registry entries by drag-dropping the addin DLL into SW and then copy-paste the resulting entries from the registry (using Regedit). Don't forget to uninstall and unregister the DLL afterward.

I use InnoSetup to create installers for my products. I have listed the Code section of the installer script of one of my products, a 3DS file import add-in for SolidWorks. Replace the GUID with that of your add-in. 'strFileName' is the name of your add-in DLL.

RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\SolidWorks \Applications\3DS Import for SolidWorks 2007', 'CLSID', '{553dc0fe-8b50-4a9b-93ab-009ea92d395e}'); RegWriteStringValue(HKEY_CLASSES_ROOT, 'CLSID \{553dc0fe-8b50-4a9b-93ab-009ea92d395e}', '', '3D Studio 3DS file import add-in for SolidWorks developed by SYCODE

formatting link
'); RegWriteStringValue(HKEY_CLASSES_ROOT, 'CLSID \{553dc0fe-8b50-4a9b-93ab-009ea92d395e}\InProcServer32', '', ExpandConstant('{app}') + '' + strFileName);

The above works for add-ins developed in VC 6.0 for SolidWorks 2007 and earlier. For add-ins developed in VC 2005 for SolidWorks 2008, I simply add the "regserver" flag on the add-in DLL in the installer script and let the installer register the DLL on the target computer. This helps because the uninstaller unregisters the add-in automatically.

InnoSetup

formatting link
is an excellent piece of freeware and I use it to create installers for all my products, 101 of them. Its very robust, flexible and ends up making really small installer EXE files. Highly recommended.

Hope this helps.

Deelip Menezes

formatting link

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required