安装SolidWorks的时候在选项里把VSTA选上,同时安装对应版本的visual studio,详情看版本的官方文档。
During SOLIDWORKS 2018 installation, click Change above the Products window on the Summary screen.
Expand SOLIDWORKS in the Product Selection window.
Select Visual Studio Tools for Applications (VSTA).
On the Summary screen, click Install Now.
During installation, a message box appears with "An app on your PC needs the following Windows feature: .NET Framework 3.5 (includes .NET 2.0 and 3.0)." Click Download and install this feature. If you do not select to download and install this feature, then VSTA 1.0 will not work.
Visual Studio Tools (1.0), Visual Studio Tools 2015, and other components are installed.