Hey guys just got my CI Server up and running but now I am having trouble finding documentation on using runners with MSBUILD and .NET projects in general. If someone could point me in the right direction that would be great!!
This is a bit broad (but so is the question, heh), but the documentation for writing your .gitlab.yml is here.
You’ll probably want a specific image
with all the build environment, etc, and will want to run a script that does all the building.
A ver minimal example:
image: some_docker_image_with_dotnet_tools
test:
script:
- build.sh
I’ve no dotnet-specific knowledge, but configuring the runner is pretty language agnostic in general.
maybe this can give an example. use fake http://fsharp.github.io/FAKE/
Also minimal .gitlab-ci.ymlexample, but it worked for me:
test: script: - cmd.exe /C " "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /p:Configuration=Release /t:Clean;Build;Zip Build.proj " && exit %%ERRORLEVEL%%
Runner is by default in the right working directory (root of the git clone), where my Build.proj file is located.
Do you know any docker image with msbuild, and .net framework 4.5+?
Hi guys,
I’ve had success with the mono image. It works for most cases when you need the .NET framework.
Here is my yml:
image: mono:4.4.0.182
build:
stage: build
script:
- nuget restore
- MONO_IOMAP=case xbuild /t:Build /p:Configuration=“Release” /p:Platform=“Any CPU” Solution.sln
It shows error:
Status: syntax is incorrect
Error: Unknown parameter: build
You should add indentations like the following code:
image: mono:4.4.0.182
build:
stage: build
script:
- nuget restore
- MONO_IOMAP=case xbuild /t:Build /p:Configuration="Release" /p:Platform="Any CPU" Solution.sln
I’ve got another problem. This script told me can’t find solution file under my folder.
Yes, found it right after posting this noob question But thanks.
Regarding your problem: Build agent expects your sln file to exist in the root of your repo. If it’s not the case. You should do “- cd PATH\TO\Solution” first line of your “script:” section. Also try to put solution file name in double quotes: MONO_IOMAP=case xbuild /t:Build /p:Configuration=“Release” /p:Platform=“Any CPU” "Solution.sln"
Thank you @pedromagueija for the script.
@shiny would you be so kind and add two additional spaces to your snippet in front of “stage: build”?
The script works for me very good (except for some compiler errors, but that is probably a nano issue after all)
Is there a similar command to run the Tests for the solution as well?
Hi Woozar,
I use the following:
- mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe ./Tests/bin/Release/Tests.dll /noresult
note that it requires a specific package (NUnit.ConsoleRunner) to be installed. Since I install it with nuget it’s automatically installed when calling.
- nuget restore
image: mono:4.4.0.182
build:
stage: build
script:
- nuget restore
- MONO_IOMAP=case xbuild /t:Build /p:Configuration="Release" /p:Platform="Any CPU" Solution.sln
- mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe ./Tests/bin/Release/Tests.dll /noresult
I tried using the mono image but I get this error:
$ nuget restore
bash: line 40: nuget: command not found
ERROR: Build failed: Process exited with: 1. Reason was: ()
I was able to build it set it to using the following;
stages:
- build
job:
stage: build
script: - echo “Restoring NuGet Packages…”
- C:\ProgramData\chocolatey\bin\NuGet.exe restore “target.sln”
- echo “Release build…”
- “&‘C:/Program Files (x86)/MSBuild/14.0/Bin/msbuild.exe’ ‘target.sln’”
tags:
except: - tags
I am use image microsoft/dotnet:latest
I am new to Git Lab yml coding. Recently I uploaded one console application to my GitLab project. I configured runner (shell) on my local laptop. when I started running job from GitLab,
I am getting below error:
‘#’ is not recognized as an internal or external command,
operable program or batch file.
‘[[’ is not recognized as an internal or external command,
operable program or batch file.
‘auto_database_url’ is not recognized as an internal or external command,
operable program or batch file.
‘export’ is not recognized as an internal or external command,
operable program or batch file.
‘export’ is not recognized as an internal or external command,
operable program or batch file.
‘export’ is not recognized as an internal or external command,
operable program or batch file.
‘export’ is not recognized as an internal or external command,
operable program or batch file.
‘export’ is not recognized as an internal or external command,
operable program or batch file.
‘function’ is not recognized as an internal or external command,
operable program or batch file.
‘docker’ is not recognized as an internal or external command,
operable program or batch file.
‘docker’ is not recognized as an internal or external command,
operable program or batch file.
‘apk’ is not recognized as an internal or external command,
operable program or batch file.
‘docker’ is not recognized as an internal or external command,
operable program or batch file.
‘wget’ is not recognized as an internal or external command,
operable program or batch file.
‘mv’ is not recognized as an internal or external command,
operable program or batch file.
‘chmod’ is not recognized as an internal or external command,
operable program or batch file.
‘touch’ is not recognized as an internal or external command,
operable program or batch file.
‘.’ is not recognized as an internal or external command,
operable program or batch file.
‘true’ is not recognized as an internal or external command,
operable program or batch file.
‘}’ is not recognized as an internal or external command,
operable program or batch file.
‘function’ is not recognized as an internal or external command,
operable program or batch file.
‘cc_opts’ is not recognized as an internal or external command,
operable program or batch file.
‘–volume’ is not recognized as an internal or external command,
operable program or batch file.
‘–volume’ is not recognized as an internal or external command,
operable program or batch file.
‘–volume’ is not recognized as an internal or external command,
operable program or batch file.
‘docker’ is not recognized as an internal or external command,
operable program or batch file.
‘docker’ is not recognized as an internal or external command,
operable program or batch file.
‘}’ is not recognized as an internal or external command,
operable program or batch file.
‘function’ is not recognized as an internal or external command,
operable program or batch file.
‘case’ is not recognized as an internal or external command,
operable program or batch file.
‘-ee)’ is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
')’ is not recognized as an internal or external command,
operable program or batch file.
“GitLab EE is required”
‘esac’ is not recognized as an internal or external command,
operable program or batch file.
‘}’ is not recognized as an internal or external command,
operable program or batch file.
‘function’ is not recognized as an internal or external command,
operable program or batch file.
‘track’ is not recognized as an internal or external command,
operable program or batch file.
‘name’ is not recognized as an internal or external command,
operable program or batch file.
“$track” was unexpected at this time.
ERROR: Job failed: exit status 255
The below one is my yml file code:
stages: build
job:
stage: build
script: ‘“C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe” “GitConsoleApplTest\GitConsoleApplTest.sln”’
only: master
Any one help me on this issue.
Firstly: it takes five minutes, the guide is free and chances are we can contribute to your current CI/CD workflow—we like to share the experience.
Secondly: if you’re not really familiar with CI/CD, we strongly advise that you take a closer look at the concept. You know for sure the Agile approach, which aims to reduce the development cycle time to minimum. The reason for that is obvious: the faster the software moves to the next stage of the development process, the faster you get the feedback and are able to deliver the improved version.
http://www.traininginrajajinagar.in/devops-training-in-rajajinagar
Hello Gregruth,
An asp.net project is a user-friendly web development system that allows the user to easily create web-based projects. These asp.net based projects help you become dot net developers in no time. Asp.net combined with C# is a powerful development framework that gives you the power of developing high-end web-based systems in no time. Browse through our list of innovative C# and asp.net based projects below:
click Here: https://mindmajix.com/net/
I get
WARNING: Error: NameResolutionFailure
WARNING: Error: NameResolutionFailure
when running nuget restore… Any hints?
Hi All, i’m looking to link up with others using .net with GitLab. If any of you are happy to chat and share some best practices, please let me know.
Thanks