Hey guys,
I’m developing the Speckle_Toolkit for BHoM.
tl;dr: I need to check if Speckle is installed on an user machine. What’s the best way of doing this?
Context
The Speckle_Toolkit references SpeckleCore.dll through Nuget. BHoM therefore must ensure that SpeckleCore is available to load (i.e. from Grasshopper, Dynamo and Excel). For example, when Grasshopper loads, GH needs to load all the BHoM stuff plus SpeckleCore.
However, we don’t know if the user has Speckle installed. We have 2 scenarios:
-
Speckle is not installed (but BHoM is).
We need to copy the Nuget SpeckleCore.dll from the Speckle_Toolkit to the BHoM installation folder so it is loaded.
This has a couple of nice side-effects. If you have BHoM, you don’t need to install Speckle to use Speckle, as the Speckle_Toolkit will now include all that is needed for operating Speckle within BHoM.
==> Speckle is supported in any software that BHoM supports. If BHoM will add another UI software (e.g., one for Godot is under consideration) then also Speckle will work for that software!
==> BHoM will always ship with Speckle (through Nuget)!
-
Speckle is installed (and BHoM too).
BHoM must NOT copy the SpeckleCore.dll in the BHoM installation folder, otherwise you get a conflicting assembly when you open e.g. Grasshopper (but also Dynamo, Excel and any other UI software where both BHoM and Speckle must coexist).
This can be solved by selectively copying the dlls from the Speckle_Toolkit to the BHoM Assembly folder, depending on whether Speckle is installed or not. The Speckle_Toolkit will have to do this check.
Since we copy the dlls by using a Post-build, my intention is to have a PostBuild event that checks if Speckle is installed; if it is not, then it the post build copies SpeckleCore in the BHoM installation folder.