- Please select -

Suggestions how to successfully deploy your .NET (C#/VB.NET) SolidWorks add-in to your users

Tips and Tricks Peter 14 December 2015

Suggestions how to successfully deploy your .NET (C#/VB.NET) SolidWorks add-in to your users

Any SolidWorks API developer can run into the scenario when the SolidWorks add-in doesn’t start on the client’s machine. Here is a list of suggestions of how to successfully deploy your .NET (C#/VB.NET) SolidWorks add-in to your users.

  1. Add-in’s Dll must be registered.

.NET based add-in must be registered using the RegAsm utility. Utility can be found at: %windir%Microsoft.NETFramework64<Version>RegAsm.exe. It is required to use /codebase argument while registering.

The registration should be done using administrative privileges

2. All 3rd party dlls must be in the same folder as the add-in.

SolidWorks interops and any other libraries must be delivered with the main add-ins dll. In most cases the dlls will be automatically copied to the bin directory while building the project.

3. Add the entries for your add-in into the registry.

Add-in must be assigned with the unique global identifier and it needs to be added into the registry. If you are using the SolidWorks SDK this is already implemented in the code.


4. Avoid unhandled exceptions within constructor or ConnectToSw method of the main class of your add-in. It is a good idea to add a try-catch block to handle any exceptions.

5. Use correct versions of Interops.

If the add-in is targeting .NET Framework 2.0 or 3.5 the interops from <SW Installation Folder>apiredistCLR2 should be used. If Framework 4.0 than interops from

<SW Installation Folder>apiredist folder should be used

6. Do not embed SolidWorks interops.

Projects targeting .NET Framework 4.0 allow embedding 3rd party interops into the main dll (this is the default option). However SolidWorks doesn’t play nicely with this feature. Make sure that the ‘Embed Interop Types’ for SolidWorks interop is set to ‘False’

Suggestions how to successfully deploy your .net (c#/vb.net) solidworks add-in to your users

7. Conflict with other .NET add-ins

The add-ins may refer to the 3rd party assembly of different version which was already loaded by another add-in. You may need to use the binding redirect or load assemblies via reflection to resolve the version incompatibility issue.


Back to Tips and Tricks