Unable to initialize the Add-In component

1,513 views
Skip to first unread message

tbischel

unread,
Apr 18, 2009, 9:41:06 PM4/18/09
to SolidWorks-API
Hey,
First off, I'm a newbie at Solidworks Development... so sorry if I'm
just posting stuff that should be easy to deal with. But you gotta
learn somewhere, right?

So I'm just trying to get the default C# Solidworks template to
compile and load in Solidworks. I'm running Visual Studio 2008, and
Solidworks 2009 x64 on Windows Vista Ultimate. The visual studio end
seems to work just fine, I am able to compile the dll. But it doesn't
appear in the Add-In manager, and when I try and open the dll through
the file menu, it pops up the "Unable to initialize the Add-In
component" message. I've tried registering the dll using regasm.exe,
and I've tried adding the directory containing the dll to the path
environment variable, but nothing seems to work. Any suggestions?

Thanks in advance for any help

Dankevich Andrey

unread,
Apr 19, 2009, 5:51:09 AM4/19/09
to tbis...@gmail.com, SolidWorks-API
Hi,
To register the add-in for x64 use post-build event command line:
"%Windir%/Microsoft.NET/Framework64/v2.0.50727/regasm" "$(TargetPath)"
"/codebase"

Good luck,
Andrey

tbischel

unread,
Apr 19, 2009, 10:53:44 AM4/19/09
to SolidWorks-API
No luck.

So what I did was as follows:
1) Generated a key pair using "sn -k mykey.snk"
2) Create a default swaddin project in C# running Visual Studio 2008
in admin mode
2) Changed the project settings to sign the assembly using the keyfile
generated above
3) registered the assembly using "regasm swaddin.dll /codebase" using
the visual studio command prompt in admin mode (actually using the
full paths)
4) Launch solidworks from the debugger, with a breakpoint attached to
the ConnectToSW function (visual studio warns that the breakpoint
won't be hit because no symbols have been loaded from that document)
5) Inspect the Active Add-in's by clicking tools->Add-Ins in
Solidworks. My add in is not listed.
6) Try to open the add in manually, clicking file->open, switching
to .dll file types, and browsing to the location of my dll. This is
where Solidworks sends the message "Unable to initialize the Add-In
component"

Anything wrong with this process flow?
--Tyler

Corey Scheich

unread,
Apr 21, 2009, 10:36:16 PM4/21/09
to tbis...@gmail.com, solidwo...@googlegroups.com
Tyler,
 
Developing for 64bit SolidWorks on a 64bit Vista environment puts you in the worst case senerio (Vista and WOW64).  It is much easier to debug a SolidWorks Addin using a 32bit machine, since Visual Studio runs in 32bit space.
 
Assuming you have to work in this environment the problem you may be having is you are using the Visual Studio command prompt to register the assembly.
 
Per Andrey's instructions it is very important that you are certain you used the Framework64/regasm.exe and not the Framework/regasm.exe (64 bit computers have 2 regasm.exe's for each major version of the .Net Framework),  now that is with the assumption that you installed 64bit SolidWorks.  If you installed 32bit SolidWorks you would use the non 64 regasm.exe.  It is possible also that you may need to turn off User Account Control or run regasm.exe as admin.
 
Regards,

Corey
 
> Date: Sun, 19 Apr 2009 07:53:44 -0700
> Subject: Re: Unable to initialize the Add-In component
> From: tbis...@gmail.com
> To: SolidWo...@googlegroups.com

Rediscover Hotmail®: Now available on your iPhone or BlackBerry Check it out.

Sylvester Machielse

unread,
May 15, 2009, 12:49:57 PM5/15/09
to SolidWorks-API
Hi,

I had the same thing:
Vista 64bit, SolidWorks 2009, 64bit. Only I use VB. I did the
following.

1. Before compiling the dll, go to "Build -> Configuration Manager"
and under "Platform" click "<New>" and select "x64".
2. Set your .dll output path the your sldworks.exe folder (e.g. X:
\Program Files\SolidWorks)
3. Compile your dll
4. Register the assembly using regasm.exe. Use the file in the
framework64 folder.
5. Now, run your project in Visual Studio.

Hope this helps,

Sylvester

Georg D.

unread,
May 23, 2009, 2:00:30 PM5/23/09
to sylvester...@gmail.com, SolidWorks-API
This should help:
 
 c:\Windows\Microsoft.NET\Framework64\v2.0.xxxxx\RegAsm.exe nameOfDllHere.dll /codebase 
--
****************************************************
*   Skype: gegy,,,gegy                                  
*   Web:   http://draxbar.no-ip.org          
*   Mail:    geg...@gmail.com            
*   Twitter: http://twitter.com/gegy    
-----------------------------------------------------------------  
*   A strange game. The only winning move is not to play.          
****************************************************

Reply all
Reply to author
Forward
0 new messages