Building a VS C++ solution with Windows shared runners on

I’ve been experimenting with the new Windows shared runners on and while I made some progress, I’m stuck trying to figure out how to build a VS C++ project using the shared runners. I’ve been guessing msbuild can be used but I can’t seem to find the right magic sauce to use it. I’m not very experienced with powershell which is almost certainly a contributing factor.

Does anyone know of an example .gitlab-ci.yml that uses the Windows shared runners (plenty of docs on setting up your own runner, etc, but I’m not interested in that path at the moment)?

Also, I haven’t been able to track down the documentation that would answer these sorts of questions for me. I can see what has been installed, but further details are sketchy. I do realise that it’s in beta and that it is a work in progress. It’s just that I can’t test the beta further at this stage.

It is a bit surprising that gitlab advertises Visual Studio in its shared runners, while at the same time seemingly providing no documentation as to how to actually use it. Anyway, after some experimentation, I eventually found one way to do it:

  msbuild: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'

  stage: build
    - '& "$msbuild" -help'
    - shared-windows
    - windows
    - windows-1809
1 Like

Thanks for the help, @krys_baka! Once you know the right way it seems so obvious! I second the call for better documentation or examples. I’m trying to build a application, so examples are even rarer.

I can now at least run msbuild and get it to fail to build my solution with the following error:
" error MSB8036: The Windows SDK version 10.0.17763.0 was not found"

Hopefully that won’t be a big deal to fix.

In any case, thanks again for your help. I really appreciate it!


Thanks for offering your wisdom, @krys_baka! :blush: