A
A
Alexey Buraikin2015-03-04 10:02:01
MSBuild
Alexey Buraikin, 2015-03-04 10:02:01

How to link Gitlab CI and Visual Studio projects?

Hi all.
There is a configured GitLab server used to share Git repositories. There was a desire to set up Gitlab CI to automatically build Visual Studio projects, and in the future - to run tests.
I set up both products, installed runner for Windows and MSBuild on a separate server. And stalled on writing a Job Script to build the application.
Has anyone done similar?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Buraikin, 2015-06-23
@bstdman

I will answer myself, here is an example job script for building Release and Debug configurations, with restoring packages from Nuget (e3Shell.Extensions.sln is the name of the solution file):

git submodule update --init
ls -la

echo "Restoring NuGet Packages..."
"c:\nuget\nuget.exe" restore "e3Shell.Extensions.sln"

echo "Debug build..."
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Debug /verbosity:quiet "e3Shell.Extensions.sln"

echo "Release build..."
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "e3Shell.Extensions.sln"

echo "Build success."

Update 10/27/15: For new versions of Gitlab (starting from version 7.12), a .gitlab-ci.yml file is created in the repository with the following content:
stages:
  - build

job:
  stage: build
  script:
  - git submodule update --init
  - ls -la
  - ''
  - echo "Restoring NuGet Packages..."
  - '"c:\nuget\nuget.exe" restore "TerminalClone.sln"'
  - ''
  - echo "Debug build..."
  - C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly
    /maxcpucount /nologo /property:Configuration=Debug /verbosity:quiet "TerminalClone.sln"
  - ''
  - echo "Release build..."
  - C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly
    /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "TerminalClone.sln"
  - ''
  - echo "Build success."
  tags: 
  except:
  - tags

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question