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:

Well, msbuild is usable, I can compile .Net application but all the stuff needed for C++ (compiler, linker, headers, …) are simply NOT installed !

So no way to compile C++ projects…

Hey there,
did you try to install the Visual Studio Community Edition (or something else?)

We have the IDE installed and use the following:

    VS2015_Dev_Build: "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\"

//later in the job:      
        - git submodule sync
        - git submodule update --init --recursive
        - '& $VS2015_Dev_Build Solution.sln /Build "debug|x64"'

Works fine for us.

As far as I understood MSBuild is only the Build ToolChain, but not the compiler, but maybe I am wrong…


I beg to differ. I’m able to compile my C++ project without issue.

1 Like

I cannot/don’t want install Visual Studio…
Could you please tell me how you’ve done it?