Gitlab CI yml file for .Net Winforms application
Sample .gitlab-ci.yml file to build a .Net windows application using Gitlab.com CI.
Step 1: Install Gitlab runner on your system. Official guide : https://docs.gitlab.com/runner/install/windows.html
Step 2: Under ‘Settings’ select ‘CI/CD’ and configure runner for your project. Disable the Shared runner and use ‘Specific Runner’ configured in previous step.


Step 3: Create .gitlab-ci.yml at the root of your repository.
Step 4: Add following content to your file with changes as per your need:
Build stage will build the code using msbuild and Deploy will copy it to desired location.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | variables: MSBUILD_PATH: 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe' stages: - build - deploy build_job: stage: build script: - '& "$env:MSBUILD_PATH" "MyWinApp.sln" /p:Configuration=Release' artifacts: expire_in: 2 days paths: - '.\MyWinapp\bin\Release\' deploy_job: stage: deploy only: - branches script: - 'xcopy /y /s ".\MyWinapp\bin\Release\*.*" "C:\Build\"' dependencies: - build_job |
Step 5: Under CI/CD pipeline you can see your build with Artifacts link.
