Installation and updates of SwEx.AddIn Framework for SOLIDWORKS add-ins

Edit ArticleEdit Article

Installing NuGet package

Select Manage NuGet Packages... command from the context menu of the project in Visual Studio

Manage NuGet Packages... command in the project context menu
Manage NuGet Packages... command in the project context menu

Search for CodeStack.SwEx in the search box. Once found click Install button for the required framework.

CodeStack.SwEx.AddIn NuGet package
CodeStack.SwEx.AddIn NuGet package

This will install all required libraries to the project.

Preparing the project

Set the Embed Interop Types to False for the SOLIDWORKS Interop libraries as shown below.

Disabling the option to embed interop types for SOLIDWORKS interops
Disabling the option to embed interop types for SOLIDWORKS interops

Check the Register for COM Interop option in project properties:

For C# project this option can be found in Build tab:

Register for COM Interop option in C# project
Register for COM Interop option in C# project

For VB.NET project this option can be found in Compile tab:

Register for COM Interop option in VB.NET project
Register for COM Interop option in VB.NET project

Updates

SwEx framework is actively developing and new features and bug fixes released very often.

Nuget provides very simple way of upgrading the library versions. Simply navigate to Nuget Package manager and check for updates:

Updating nuget packages
Updating nuget packages

In order to see the release notes, follow the links below for the corresponding library.

In some cases updating the libraries may reset the Embed Interop Types option to True for SOLIDWORKS interop assemblies.

SOLIDWORKS interop option is reset to True after the update
SOLIDWORKS interop option is reset to True after the update

It is recommended to set it back to False.

Supporting multiple versions of the SwEx framework

Methods signatures and behaviour of SwEx framework might change in new versions. SwEx libraries are strong named which prevents the compatibility conflict in case several add-ins loaded in the same session of SOLIDWORKS referencing different versions of framework.


Product of Xarial Product of Xarial