Today I managed to compile C++/CLI with XMake, without MSBuild. Rejoice! ofc there’s zero editor support, no hot-reload, and right now there is still some jank in dotnet_cpp_cli. But you can have the combined power of libraries from both Nuget and XRepo. What a time to be alive!
I’ve ironed out couple of things in the workflow, I’ve now implemented my own SpaceMouse reader with it which I copied from my Unreal plugin. It’s working pretty good now with xmake, if the compile_commands.json is generated for VS Code, auto completion even picks up the namespaces imported from managed assemblies.
xmake project -k compile_commands .vscode
same goes for big visual studio
xmake project -k vsxmake2026 -m "debug,release"
My initial problem with code-completion was with the range-v3 library (equivalent toolset to LINQ in C# but for C++ containers) which may have done internally too deep templating magic, and code analysers had a hard time with that combined with C++/CLI mode (maybe because C++/CLI introduces its own templating-like syntax for runtime generics of managed types idk).
Once I’m gonna figure out the quirks of pushing these binaries to Nuget, I’m gonna publish this. The CLR compiler flags and the plumbing of managed DLL references is currently done in a Lua script next to xmake.lua (the equivalent to CMakeLists.txt in a more traditional C++ project) but probably would be more elegant as an xmake addon where dotnet_cpp_cli would be a rule.
I was bike-shedding with the xmake part but here it is GitHub - microdee/VL.Mcro.Devices.SpaceMouse: A C++ implementation for reading 3DConnexion Space Mice from HID directly in vvvv-gamma · GitHub , also on Nuget. I didn’t end up using them in this plugin, but you can decorate your managed things with attributes the same way how that’s done in C#. Actually they’re used in the AssemblyInfo.cpp˛ for surprise, the assembly info attributes. So for example the managed function that became the SpaceMouseMainLoop process node, could be a decorated ref class as well, and probably that would have been better to hold a state.
Anyway I hope it’s at least an interesting read for some.
Out of curiosity: you could have used the import attributes like ImportAsIs / ProcessNode etc. and vvvv would’ve picked up the nodes directly? Nice to know this option exists now.
yep exactly. There are some official example snippets on MSDN. So for example the ProcessNode example in the documentation would look like this in C++/CLI:
[ProcessNode]
public ref class Counter
{
private:
int _value;
public:
int Update([Pin(Name = "Increment")] int i)
{
return _value += i;
}
}
They were always available in C++/CLI, I used them for vvvv-beta nodes in FBX4V a long time ago