Reload Add'ins in Solidworks PDM

708 views Asked by At

I'm still rather new to the world of API programming in Solidworks PDM, and i have run into a cumbersome problem i was hoping to get some insight in: For many normal API's in PDM, it is simply enough to add the .DLL file in PDM-Administration as 'Debug', and from thereon out, whenever the solution in VisualStudio is being rebuild, the PDM-Administration will automatically grab the same DLL-file, the next time it is being called from PDM. This is great for Debugging, no problem here.

But, as soon as the API has to trigger a task (to be executed on a client PC), it can only be added to PDM as a normal task (no debug mode), then added to the 'Task Host Configuration' on the client, and then configured as a 'New Task' in PDM-Administration.

This all works fine; BUT, it takes quite some time to change anything, since the only way i can get changes to take effect, is first to rebuild the Solution in VisualStudio, then manually overwrite the DLL-file in PDM-Administration, and finally reboot the client-PC (to force-update which version of the add-in it sees).

I have tried; logging out/in-again(in PDM), restarting the explorer, and clearing the local PDM-Cache... nothing has happened here

Can any of you give me some advice on how you debug PDM API's? or at least force-reload a addin on the clients. Specifically suggestions to task-add'ins will be much appreciated. Thank You.

1

There are 1 answers

1
Bobby Jones On

Unfortunately there isn't a clean way to debug task addins.

It is possible to attach your debugger to the PDM process itself but its not trivial. Here's the gist of it as explained by Lee Young,

It depends on what portion of the task you're attempting to debug. If you're looking to debug the task setup in the Administration Tool, all you need to do is attach to the conisioadmin.exe process.

To debug an executing task, it gets a little trickier. Load up your add-in as usual and select your machine to be the only machine that will execute the task. (In the task setup.) Close the administration tool. You'll need to create a symlink from the file in the plugins directory to your debug dll. I personally use DirLinker. The plugins directory is located at AppData\Local\SolidWorks\SolidWorks Enterprise PDM\Plugins\VaultName.

In your sourcecode, place a messagebox.show in the OnCmd method and place a breakpoint at that line. Once the task loads up, the task will wait for the messagebox to be closed. When the messagebox is shown, you can attach to TaskExecutor.exe and then you'll be able to debug. If you're not hitting breakpoints, make sure you have the correct .NET framework version selected when debugging.

If you're still not hitting breakpoints, EPDM probably loaded another instance of your dll into the plugins directory.

For simple task addins, my approach is to debug via the method you described (reload it manually every time). Proper logging will help a lot here (Print ex.StackTrace on every exception).

For more complex tasks, you can create a separate 'debug' project that has some hardcoded (or dynamic) inputs and calls your code. This will get you close before testing in the PDM environment. A PDM task is basically a COM process on the client machine so that's pretty simple to mimic, aside from the actual PDM Task environment, which is full of bugs.

Hope this helps.