Implement a build server for dot net core project

I have been given a task implement a build server for our companies main project. I am beginner who only knows C# and I am highly confused after seeing file.

I need to implement a build server such that non tech people at my company can just download the build and run the exe without worrying about downloading any package.

  1. The project is hosted on Gitlab. Does it need to be hosted on AWS or Azure to implement CI CD? I see many tutorials which either are related to AWS or Azure?

  2. How does the yml file know how to build the project ?


Hi @Npundir

  1. You can either use GitLab shared runners or provide your own runners. If you provide your own, they can be hosted anywhere. AWS and Azure are fine, but your own on-prem servers, or anything else is fine too. You will need sudo rights to install the runner but not much else.
  2. I would suggest you use the dotnet project template to begin with and see how you get on (or maybe just fork that project an iterate from there). Essentially though, you will write shell commands in your .gitlab-ci.yml file and these will be executed in the pipeline.

Good luck!

Thanks, I was working with dot net core template.
Currently I am facing this error

MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

Dir in yml -

NOTE: Please edit this path so it matches the structure of your project!

SOURCE_CODE_PATH: ‘tutorialandtesting\TutorialAndTesting\TutorialAndTesting.sln’

I have tried all the possibilities - tried giving all possible paths with respect to both gitlab and local directory and with both \ & /.

Can you guide me with how to specify working directory?

I am facing the same issue. I have a runner with several stages, like test, build and deploy.

The build-part creates an artifact with a powershell-module, which should be published by the next stage “deploy”, but when this stages runs, it´s returing this error:

Running with gitlab-runner 15.7.1 (6d480948)
  on mpsRepository nKoF23E9
Preparing the "shell" executor 00:00
Using Shell executor...
Preparing environment 00:02
Running on MIGHTY-NB03...
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in C:/gitlab-runner/builds/nKoF23E9/0/hive/mpsRepository/.git/
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See for more information.
Checking out 62efa49e as main...
Removing modules/
git-lfs/3.3.0 (GitHub; windows amd64; go 1.19.3; git 77deabdf)
Skipping Git submodules setup
Downloading artifacts 00:04
Version:      15.7.1
Git revision: 6d480948
Git branch:   15-7-stable
GO version:   go1.18.9
Built:        2022-12-19T12:29:14+0000
OS/Arch:      windows/amd64
Downloading artifacts for Build - Module (992)...
Runtime platform                                    arch=amd64 os=windows pid=12068 revision=6d480948 version=15.7.1
Downloading artifacts from coordinator... ok        id=992 responseStatus=200 OK token=3_TUY1yx
Executing "step_script" stage of the job script 00:06
$ if (-not (Get-Command -ErrorAction SilentlyContinue git)) {choco install git -y force}
$ if (-not (Get-Command -ErrorAction SilentlyContinue pwsh)) {choco install pwsh -y -force}
$ git fetch --unshallow --all
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See for more information.
$ dotnet pack -c Release
MSBuild version 17.4.0+18d5aef85 for .NET
MSBUILD : error MSB1003: Geben Sie eine Projekt- oder Projektmappendatei an. Das aktuelle Arbeitsverzeichnis enthält keine Projekt- oder Projektmappendatei.
Cleaning up project directory and file based variables 00:04
ERROR: Job failed: exit status 1

I copy and pasted the CI/CD-template from my gitlab selfhosted instance version 15.7:


  - deploy

  stage: deploy
    - dotnet pack -c Release
    - dotnet nuget add source "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text
    - dotnet nuget push "bin/Release/*.nupkg" --source gitlab
    - main
  environment: production

It complained that I have no runner defined, so I added this to the section:

    - Windows
    - Powershell
    - Stage_Deploy

to trigger the runner on my own Windows 11 maschine.

After that It throws the error mentioned above.

I also created several access tokens, for instance one like that:

and changed the the username in this line to the token Name:

dotnet nuget add source "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/nuget/index.json" --name gitlab --username deployment --password $CI_JOB_TOKEN --store-password-in-clear-text