I wrote a custom c# add-in that uses the API and worked great when we were using SW2016 SP5.0. However, when we updated to 2018, I started encountering strange errors that are causing some calls to break.
I can't wrap my head around the reason for this error or a potential fix.
Scenario:
I have a drawing open. I click export on my add-in to output a STEP file. The add-in goes through the print to find the referenced document file path and then calls ActivateDoc3(Name, UseUserPreferences, Option, ref Errors). None of these variables are null or incorrectly formatted.
Error:
ActivateDoc3 Error
Could not load file or assembly 'gdtanalysissupport, Version=11.37.0.0, Culture=neutral, PublicKeyToken=[a bunch of numbers]' or one of its dependencies. The system cannot find the file specified.
The 3D referenced file does not open and causes further issues. I don't know why that DLL is being called nor do I know why it can't find it. It's located in my installation folder, right where it was installed. Has anybody encountered this or have any suggestions?
I know it's usually best to supply code and example files but neither of those are options and I can't recreated this with every file unfortunately. It only happens to some so I can't create a test file and repeat it.
How are you creating your add-in project? Are you using the wizard for Visual Studio provided by SOLIDWORKS?
I've attached a copy of the add-in project I used for testing. You will probably have to remove and re-add the broken project references before it will build. Make sure you point to the references in your SOLIDWORKS 2018 folder. Also, update the project Debug settings to the proper location for your SLDWORKS.exe file as the startup application as well. Build it and see what happens.