I have a solution with several .NET projects in it. I use GitLab, not self-hosted, for version control and would like to start using their CI tools as well. I have added the following .gitlab-ci.yml
file to my root:
stages:
- build
- test
build_job:
stage: build
script:
- 'echo building...'
- 'msbuild.exe Bizio.sln'
except:
- tags
test_job:
stage: test
script:
- 'echo: testing...'
- 'msbuild.exe Bizio.sln'
- 'dir /s /b *.Tests.dll | findstr /r Tests\\bin\\ > tests_list.txt'
- 'for /f %%f in (tests_list.txt) do mstest.exe /testcontainer: "%%f"'
except:
- tags
The build
stage always fails because it doesn't know what msbuild
is. The exact error is:
/bin/bash: line 61: msbuild.exe: command not found
After some investigating, I've figured out that I'm using a shared runner. Here is the entire output from the job run:
Running with gitlab-runner 10.6.0-rc1 (0a9d5de9)
on docker-auto-scale 72989761
Using Docker executor with image ruby:2.5 ...
Pulling docker image ruby:2.5 ...
Using docker image sha256:bae0455cb2b9010f134a2da3a1fba9d217506beec2d41950d151e12a3112c418 for ruby:2.5 ...
Running on runner-72989761-project-1239128-concurrent-0 via runner-72989761-srm-1520985217-1a689f37...
Cloning repository...
Cloning into '/builds/hyjynx-studios/bizio'...
Checking out bc8085a4 as master...
Skipping Git submodules setup
$ echo building...
building...
$ C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe Bizio.sln
/bin/bash: line 61: msbuild.exe: command not found
ERROR: Job failed: exit code 1
It looks like the shared runner I have is using a Docker image for Ruby, which seems wrong. I don't know how I can change that or select a different one that can be used for .NET. After some further investigating I'm getting worried that I'll have to jump through a lot of hoops to get what I want, like using an Azure VM to host a GitLab Runner that can build .NET apps.
What do I need to do to use GitLab's CI pipelines to build my .NET solution using a non-self-hosted GitLab instance?