.gitlab-ci.yml用于C#使用Docker image mono
我正在尝试为构建c#应用程序设置.gitlab-ci.yml用于C#使用Docker image mono,c#,build,mono,gitlab,gitlab-ci,C#,Build,Mono,Gitlab,Gitlab Ci,我正在尝试为构建c#应用程序设置gitlab cirunner。已经使用mono image设置了gitlab、gitlab ci、docker、runner 我正在尝试xbuildexample.sln,但需要获得nuget包,我不知道如何获得 我的.gitlab ci.yml当前看起来像这样。它将进入建筑,但由于缺少包而出现错误 before_script: build: script: - xbuild "example.sln" 在before脚本中,您需要安装并运行nu
gitlab ci
runner。已经使用mono image
设置了gitlab、gitlab ci、docker、runner
我正在尝试xbuild
example.sln,但需要获得nuget包
,我不知道如何获得
我的.gitlab ci.yml
当前看起来像这样。它将进入建筑,但由于缺少包而出现错误
before_script:
build:
script:
- xbuild "example.sln"
在before脚本中,您需要安装并运行nuget命令行客户机,就像使用bash一样,以在构建项目之前获取依赖项 编辑:Ok nuget已经安装在官方mono图像上,所以您只需执行以下操作:
before_script:
- nuget restore -NonInteractive
build:
script:
- xbuild "example.sln"
我不确定nuget命令,因为我不熟悉C#和Mono我花了一些时间来弄清楚如何运行NUnit测试,特别是因为Gitlab的Mono模板不再是最新的,因此我必须找到nuget包的正确路径:
image: mono:latest
stages:
- build
- test
build:
stage: build
script:
- nuget restore
- MONO_IOMAP=case xbuild /t:Build /p:Configuration="Release" /p:Platform="Any CPU" MyPlugin.sln
test:
stage: test
script:
- nuget restore
- MONO_IOMAP=case xbuild /t:Build /p:Configuration="Release" /p:Platform="Any CPU" MyPlugin.sln
- mono /root/.nuget/packages/nunit.consolerunner/3.9.0/tools/nunit3-console.exe Plugin.Tests/bin/Release/Plugin.Tests.dll
感谢您的回答,我使用了
-nuget restore-example.sln
,工作正常。