Compiling micro-manager2 device adapters in windows with visual studio code (vscode)

Hello,

since the pump device has finally been integrated into MM (huge thanks to Mark and everyone else involved), I thought I’d take another look at releasing my Hamilton device adapter (the one from way back when).

First step since I’m quite new to MM2 development, I looked at the instructions and noticed that they are maybe geared towards using Visual Studio rather than VSCode IDE as the IDE. Is that correct?

So first hurdle is that (at least with a free MS subscription) the VS 2019 MSBuild tools are not available to download any more.

So instead, I downloaded the VS community 2022 build tools installer from this link and added msvc142 and the two Windows 10 SDKs as in the documentation.

In my vscode global settings, I added this section:

    "terminal.integrated.env.windows": {
        "PATH": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\MSBuild\\Current\\Bin\\amd64;${env:PATH}"
    }

To build a device adapter, say Mark’s HamiltonMVP adapter, what I do in my vscode is

  • Open the folder …MM\mmCoreAndDevices\DeviceAdapters\HamiltonMVP
  • Open a terminal
  • Type msbuild HamiltonMVP.vcxproj /p:Configuration=Release /p:Platform=x64

I haven’t yet looked at whether the adapter I built actually works, but at least it compiled! :slight_smile:

That’s it for now. I’d love to hear if other devs use vscode for MM/MM2 development and whether you’re also able to debug device adapters from within vscode, that would help quite a lot I think!

Cheers,
Egor

You may get more responses to your question on image.sc as that is where most of micro-manager development questions go.

Personally I’ve been using Visual Studio for MM2 development on Windows. It seems to work.

@Hazen_Babcock

So, the method I described using msbuild tools did actually produce a working device adapter.

In any case, thanks for the feedback.

You may get more responses to your question on image.sc as that is where most of micro-manager development questions go.

No worries, I thought since this is purely a micro-manager development question, I’d have more chances to catch other developers here.

Personally I’ve been using Visual Studio for MM2 development on Windows. It seems to work.

Talking of personal preferences, I already use vscode for all my development (platformio, qupath, python…) so I’m happy to report vscode may also be used to develop a subset of MM (at least as far as mmCoreAndDevices development is concerned).

If it turns out you don’t need a complete Visual Studio installation to just develop device adapters (debugging would be nice), I’ll submit a pull request to the documentation for some simplified instructions. If it doesn’t, watch for some grovelling and ninja edits!

Cheers for now,
Egor