c# - 在 C# 中使用 GitLabCI

标签 c# gitlab gitlab-ci

我一直在开发 C# 应用程序,想试用 GitLab CI。我只能看到 Ruby,但找不到有关如何使用它构建 C# 应用程序的任何信息。

当我运行测试设置时,我进行了提交,但我没有构建。

Enter image description here

我应该如何进行简单构建?我可以使用哪个命令?我不介意构建失败(但构建失败)。

最佳答案

我只是想分享我的 .gitlab-ci.yml 完成单元测试。您将不得不调整您的 nuget 和可能的其他路径。这是针对同名解决方案中的单个项目。

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

关于c# - 在 C# 中使用 GitLabCI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32821281/

相关文章:

git - 在 merge 或推送之前强制特性分支 rebase

django - Docker:从Web容器内部执行将django迁移到db容器

gitlab-ci - 如何将运行者限制在特定分支并锁定 .gitlab-ci.yml 免受更改?

docker - Gitlab-CI:跨服务通信

c# - 粗鲁的代码。 IoC 来拯救

c# - XCopy 在构建期间失败但不是从命令行失败?

C# 获取具有特定且完全匹配扩展名的文件

c# - 如何在不枚举查询的情况下将 string 转换为 int

git 忽略 .env 文件不起作用

gradle - 我的Gitlab CI/CD管道无法通过FATAL进行高速缓存:文件不存在错误