windows 通过命令行/通过Jenkins“执行批处理命令”创建安装程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7070358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating an installer via command line / through Jenkins "Execute Batch Command"
提问by Sagar
We use Jenkins for CI.
我们使用 Jenkins 进行 CI。
I have a project that is built in Windows, using CMake 2.8.4 and VS2010 (NMake Makefiles). Once the build is complete, we manually zip up the artefacts to give to people. I would like to create an installation package via Jenkins if possible, instead of having to zip up everything.
我有一个在 Windows 中构建的项目,使用 CMake 2.8.4 和 VS2010(NMake Makefiles)。构建完成后,我们手动压缩人工制品以提供给人们。如果可能,我想通过 Jenkins 创建一个安装包,而不必压缩所有内容。
Does anyone know of an installer that can work completely command line, so I can put the command in the Jenkins "Execute Batch Command" window? Has anyone done this? What installer-creator are you using? Hopefully looking for something in the free/open-source arena.
有谁知道一个可以完全在命令行工作的安装程序,所以我可以把命令放在 Jenkins 的“执行批处理命令”窗口中?有没有人做过这个?您使用的是什么安装程序创建器?希望在免费/开源领域寻找一些东西。
采纳答案by Bernard
I've used Inno Setupthrough Jenkins with much success. It is a free installer for Windows. Installation files are created via scripts and command-line arguments can be used when executing these scripts to create installation files. Inno Setup scripts can be added to your source control repository for tracking changes, while also making them accessible to Jenkins.
我已经通过 Jenkins使用Inno Setup并取得了很大的成功。它是 Windows 的免费安装程序。安装文件是通过脚本创建的,当执行这些脚本来创建安装文件时,可以使用命令行参数。Inno Setup 脚本可以添加到您的源代码控制存储库中以跟踪更改,同时还使 Jenkins 可以访问它们。
回答by Anders Lindahl
We use Nullsoft Scriptable Install System (NSIS), and have Jenkins call a batch file in the repository to build our installer. The NSIS binaries are also stored in the repository, no need to install anything on the build server. The NSIS configuration is a text file, looking something like this (from NSIS Simple Tutorials):
我们使用Nullsoft Scriptable Install System (NSIS),并让 Jenkins 调用存储库中的批处理文件来构建我们的安装程序。NSIS 二进制文件也存储在存储库中,无需在构建服务器上安装任何东西。NSIS 配置是一个文本文件,看起来像这样(来自 NSIS简单教程):
# name the installer
outFile "Installer.exe"
# default section start; every NSIS script has at least one section.
section
# default section end
sectionEnd
So far it has been working perfectly. The configuration language is a little unusual, but it is not too hard to grasp and the result is stable and predictable. There are plenty of examples and tutorials in the installation and on the web site.
到目前为止,它一直在完美地工作。配置语言有点不寻常,但不难掌握,结果稳定可预测。安装和网站上有大量示例和教程。
回答by Alexey Ivanov
We used WiX Toolsetto create an Windows Installer package (MSI). It is open source.
我们使用WiX 工具集来创建 Windows 安装程序包 (MSI)。它是开源的。
All the tools are command line and we called them from an Antscript. MSI can be installed without user being involved, which could be used for testing.
所有工具都是命令行,我们从Ant脚本中调用它们。无需用户参与即可安装MSI,可用于测试。
WiX Toolset also has a plugin to Visual Studio?– Votive.
WiX 工具集也有 Visual Studio 的插件?—— Votive。
There's a good tutorialon how to create installs using WiX.
有一个关于如何使用 WiX 创建安装的很好的教程。
回答by Dave Bacher
We run InstallShieldas a batch command to build a Windows installer. The setup process for the packaging is entirely GUI driven, but you can build the installer package from the command line. InstallShield is not free though.
我们将InstallShield作为批处理命令运行以构建 Windows 安装程序。打包的安装过程完全是 GUI 驱动的,但您可以从命令行构建安装程序包。InstallShield 不是免费的。
The InstallShield configuration is a binary file, so it's hard to see what's changed from build to build.
InstallShield 配置是一个二进制文件,因此很难看出从构建到构建发生了什么变化。
Update: In our implementation (using InstallShield 2011), there's a Jenkins job with two parameters, ProjectConfig
and ReleaseConfig
. The Jenkins job checks out the InstallShield project including the Project.ism
and runs:
更新:在我们的实现中(使用 InstallShield 2011),有一个带有两个参数的 Jenkins 作业,ProjectConfig
和ReleaseConfig
. Jenkins 作业检查 InstallShield 项目,包括Project.ism
并运行:
"\Program Files\InstallShield11\System\IsCmdBld.exe" -a "%ProjectConfig%" -r "%ReleaseConfig%" -b "%BuildDir%" -p Project.ism
You can get more details on the command line options by running IsCmdBld -?
or in the InstallShield documentation.
您可以通过运行IsCmdBld -?
或在 InstallShield 文档中获取有关命令行选项的更多详细信息。
回答by Slappy
You can integrate both Inno Setupand NSISinstallation systems with Jenkins using MSBuild Plugin.
您可以使用MSBuild 插件将Inno Setup和NSIS安装系统与 Jenkins集成。
There is Visual & Installer(http://www.visual-installer.com) extension which allows you to create installation project (compatible with MSBuild) in Visual Studio and compile it from command line (or directly in VS).
有Visual & Installer( http://www.visual-installer.com) 扩展,它允许您在 Visual Studio 中创建安装项目(与 MSBuild 兼容)并从命令行(或直接在 VS 中)编译它。
All parameters and arguments are stored in Visual Studio solution/project files so there is no need to pass them manually in batch.
所有参数和参数都存储在 Visual Studio 解决方案/项目文件中,因此无需手动批量传递它们。
Also there is support for multiple platforms, targets and configurations everything can be defined and you can switch among them (The same work as in regular Visual Studio).
还支持多个平台、目标和配置,一切都可以定义,您可以在它们之间切换(与常规 Visual Studio 中的工作相同)。