SolidWorks API Add-In installer problem

Programming and macros
gadgetsuh
Posts: 4
Joined: Fri May 27, 2022 9:03 pm
Answers: 0

SolidWorks API Add-In installer problem

Unread post by gadgetsuh »

I made a SolidWorks Add-In program in C# and try to make an installer for the Add-In. I use Microsoft Visual Studio 2022 community edition and tried both the Microsoft Installer and WIX. Everything goes fine and the Add-In is listed in the SolidWorks Add-In dialog box. However, if I check my Add-in in the Add-In dialog box, my Add-In is not loaded, and the checkbox is unchecked automatically. If I keep the original Add-In DLL that is generated by the Visual Studio in its output folder, SolidWorks finds that DLL and loads it instead. If I delete the original Add-In DLL (not the installed DLL), then SolidWorks won't find and load the installed Add-In DLL (that is installed on C:\Program Files). I checked the Windows registry, and it looks like all information is correct in the registry. What am I missing?

Thank you
YS
User avatar
AlexB
Posts: 508
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 29
x 278
x 463

Re: SolidWorks API Add-In installer problem

Unread post by AlexB »

This write-up that Artem put together helped me get things working with my add-in. Hopefully it help you too.

https://www.codestack.net/solidworks-ap ... aller/wix/
gadgetsuh
Posts: 4
Joined: Fri May 27, 2022 9:03 pm
Answers: 0

Re: SolidWorks API Add-In installer problem

Unread post by gadgetsuh »

AlexB wrote: Sat May 28, 2022 11:59 pm This write-up that Artem put together helped me get things working with my add-in. Hopefully it help you too.

https://www.codestack.net/solidworks-ap ... aller/wix/
Thank you for your reply. That article is exactly what I followed, but the add-in is not loaded when it is installed on a new computer. It works fine in the development computer as the DLL is loaded from the DLL output from the Visual studio.
User avatar
AlexB
Posts: 508
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 29
x 278
x 463

Re: SolidWorks API Add-In installer problem

Unread post by AlexB »

gadgetsuh wrote: Sun May 29, 2022 1:58 pm Thank you for your reply. That article is exactly what I followed, but the add-in is not loaded when it is installed on a new computer. It works fine in the development computer as the DLL is loaded from the DLL output from the Visual studio.
Good to see you found the article already. Are you using the "Approach A: Post build action" to register your project's COM components? If so, is this inside your WIX <Feature> tag as a <ComponentGroupRef> to tell it to register these when installing?
image.png
The description of your problem sounds like it's caused by an improperly registered DLL so I would begin looking at the DLL registration portion of the install. I ran into something similar and ended up generating all new GUIDs for my installer's <ComponentGroup> fields and everything worked.
User avatar
bnemec
Posts: 1967
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2580
x 1427

Re: SolidWorks API Add-In installer problem

Unread post by bnemec »

At the risk of being Captain Obvious here; the two things that burn me over an over:

1: Project Properties -> Build tab, Platform target: set it to 64 bit or at least >uncheck "Prefer 32-bit" CAD stuff has been all 64 bit for a couple years now, no need to compile for 32 that I know of.

2: Project References, Solidworks Library (or whatever software's API you're using) Embed Interop Types should usually be set to False.
gadgetsuh
Posts: 4
Joined: Fri May 27, 2022 9:03 pm
Answers: 0

Re: SolidWorks API Add-In installer problem

Unread post by gadgetsuh »

AlexB wrote: Tue May 31, 2022 8:42 am Good to see you found the article already. Are you using the "Approach A: Post build action" to register your project's COM components? If so, is this inside your WIX <Feature> tag as a <ComponentGroupRef> to tell it to register these when installing?
image.png
Yes, those are included. I checked my Product.wxs with the one on the website line by line. There must be something missing or wrong but I cannot find it.

When running Solidworks, the Splash windows shows that the add-in is loading. The add-in is listed in the Add-In dialog box (Tools > Add-In). When I hover my mouse over the add-in item listed in the dialog box, however, the tool-tip pops up showing the Visual Studio output folder, not the installation folder. I don't know how to let SolidWorks load the add-in DLL from the installed directory.
gadgetsuh
Posts: 4
Joined: Fri May 27, 2022 9:03 pm
Answers: 0

Re: SolidWorks API Add-In installer problem

Unread post by gadgetsuh »

bnemec wrote: Tue May 31, 2022 10:36 am At the risk of being Captain Obvious here; the two things that burn me over an over:

1: Project Properties -> Build tab, Platform target: set it to 64 bit or at least >uncheck "Prefer 32-bit" CAD stuff has been all 64 bit for a couple years now, no need to compile for 32 that I know of.

2: Project References, Solidworks Library (or whatever software's API you're using) Embed Interop Types should usually be set to False.
Thank you for your input. Yes, I set 64bit, and all are set to False.
Post Reply