Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using GitLab CI with C# [duplicate]

I've been working on a C# application and wanted to try the GitLab CI out. All I can see is Ruby and can't find any information on how to build a C# application using it.

When I run the test settings, I make the commit, but I don't have my build.

Enter image description here

How should I make a simple build? Which command could I use for that? I don't mind if I get a failed build (but a build).

like image 661
Andres Rojano Ruiz Avatar asked Nov 21 '22 04:11

Andres Rojano Ruiz


1 Answers

I just wanted to share my .gitlab-ci.yml complete with unit testing. You will have to adjust your nuget and possibly other paths. This is for a single project in a solution of the same name.

variables:
  PROJECT_NAME: "ProjectNameGoesHere"
before_script:
  - echo "starting build for %PROJECT_NAME%"
  - echo "Restoring NuGet Packages..."
  - d:\tools\nuget restore "%PROJECT_NAME%.sln"
stages:
  - build
  - test
build:
  stage: build
  script:
  - echo "Release build..."
  - '"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe" /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "%PROJECT_NAME%.sln"'
  artifacts:
    untracked: true
test:
  stage: test
  script:
  - echo "starting tests"
  - cd %PROJECT_NAME%Tests/bin/Release
  - '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:%PROJECT_NAME%Tests.dll'
  dependencies:
  - build
like image 95
Jeff Avatar answered Dec 14 '22 20:12

Jeff