Check if Speckle is installed

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?


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:

  1. 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)!

  1. 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.

Hello Alessio,

There’s currently a few ways in which you can check if the installer has run:

  1. If %localappdata%\Speckle and its contents exist
  2. If there is a registry key in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\{BA3A01AA-F70D-4747-AA0E-E93F38C793C8}_is1
  3. If there is a SQLLite db in %localappdata%\SpeckleSettings (you could also use that to check if there are any accounts)

Ultimately, if you wan to check individually which connector has been installed, the only way is to check in each connector folder, you can see a breakdown of the various paths in: SpeckleInstaller/SpeckleInstaller.iss at master · speckleworks/SpeckleInstaller · GitHub

1 Like

In regards to conflicting multiple versions of SpeckleCore loaded, it might not be a good approach keeping only 1 copy of the assembly in the host software.

This is because if, for instance, the BHoM toolkit uses SpeckleCore v2 and another installed connector uses v1, one of the two will be referencing the wrong version.
It’s best if both the BHoM and the Speckle Connectors in the host application can each reference the version of SpeckleCore they were built against.

As an alternative solution I can suggest to use an alias on the reference, that’s the approach we took for loading a different vesion of Newtonsoft in Dynamo.

1 Like