c# - 我可以使用 Jenkins 在 Ubuntu 上构建 C# 项目吗?

标签 c# .net linux jenkins

我们有 JenkinsUbuntu OS 18.04.01 LTS 上运行,还有一个用 C#/.NET 4.5 编写的旧项目

应用程序过去总是手动构建,我想使用 Jenkins 引入 CI,因此不再需要手动构建项目。该应用程序不必在 Linux 或类似系统上运行,我们只需要构建文件(可执行文件和 DLL 文件)。是否可以在 Ubuntu 上使用 Jenkins 构建此 C# 解决方案?

我知道 MONOXBUILD 但实际上我无法在 ubuntu 下构建项目,因为在 Windows< 下不会发生不同的问题,例如看这里:

 UserControls/ExpandablePanel.cs(33,35): error CS1043: Invalid accessor body `=>', expecting `;' or `{'
    UserControls/ExpandablePanel.cs(33,66): error CS1043: Invalid accessor body `=>', expecting `;' or `{'
    UserControls/ExpandablePanel.cs(35,41): error CS1043: Invalid accessor body `=>', expecting `;' or `{'
    UserControls/ExpandablePanel.cs(37,40): error CS1043: Invalid accessor body `=>', expecting `;' or `{'
    UserControls/ExpandablePanel.cs(133,22): error CS1644: Feature `pattern matching' cannot be used because it is not part of the C# 6.0 language specification
    UserControls/PagedDataGridView.cs(441,68): error CS1043: Invalid accessor body `=>', expecting `;' or `{'

     1 Warning(s)
     6 Error(s)

是否有可能或者我确实需要在 Windows 机器上运行 Jenkins

最佳答案

这是可能的。您可以在 Linux/Ubuntu 上构建 C# 项目。尝试使用 mono 构建.何时安装 mono包,您将获得的二进制文件之一将是 xbuild .要构建只需调用以下命令:

xbuild <path to csproj/solution file>

首先尝试手动构建它,然后与 jenkins 集成。

关于c# - 我可以使用 Jenkins 在 Ubuntu 上构建 C# 项目吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54998383/

相关文章:

c# - 为什么我们不能在 C# 项目中使用 F# 类?

c# - 跨请求持久声明

c# - 将 WPF DataGrid ItemsSource 绑定(bind)到自定义 Table 对象的方法 IEnumerable<TableRow> GetRows()?

c# - 如何使正则表达式适用于角落案例电子邮件地址

linux - Linux 上的 ActiveMQ

c# - 无法从用法中推断出方法 '' 的类型参数。尝试明确指定类型参数

c# - 将其装饰函数的功能包装在一些外部代码中的属性

c# - 如何在 C# 代码而不是 XAML 中创建超链接

Python:如何在 Linux 的特定目录中找到上一小时创建的新文件夹/目录

c++ - 为什么动态分配的两个变量的内存位置不连续?