如何创建仅将目录复制到 Program Files 的 MSI 文件?

How to create a MSI file which simply copies a directory to Program Files?

我想创建一个 MSI 文件,它只是将一个目录复制到 "Program Files" 目录中,并在开始菜单中创建一个图标。

仅此而已。 没有对用户的问题,没有依赖性,没有注册表项等。 只需复制目录并设置图标即可。

如果我们部署新版本的程序,那么 MSI 应该只是将新版本复制到旧版本上。没有 "uninstalling" 程序。

该任务使用哪个工具?

我想答案是任何常用工具,因为它们都可以做到这一点。 Here is a list of (arguably) the most common tools.

  • 您可能不易受的 Visual Studio Installer Projects (2017) are pretty simple to use - at first - and then you face - 考虑到您的范围。 据我所知,无法在构建过程中实现自动化!
  • Advanced Installer is a commercial product and it has that you can use for requirements such as yours. You could give it a test spin. Here is a great gateway 所有高级安装程序。
  • WiX is capable of what you want to do, and entirely free. Takes a while to get used to. The Hello World of WiX (a little old and dated, but you get the picture - XML markup that is compiled to MSI format). For some reason, this messy answer of mine on WiX Quick Start 的投票比平时多(现在更新答案 - 很小)。也许浏览一下。

有关直接下载链接,请参阅顶部的链接答案。


静默安装:任何 MSI 文件都可以 运行 通过标准 运行 静默安装(没有 GUI)msiexec.exe 命令行:

msiexec.exe /I "C:\Your.msi" /QN /L*V "C:\msilog.log"

快速参数说明:

/I = run install sequence
/QN = run completely silently
/L*V "C:\msilog.log" = verbose logging at specified path

只是为了扩展 Stein 的回答,使用 Advanced Installer 的 free edition("Simple" projects only) 你可以构建这个简单的包。

创建项目后,只需转到产品详细信息页面并禁用显示“注册Windows安装程序[=21=”的选项]”。

很可能上面提到的所有工具都有类似的选项,你只需要搜索它,因为我不太熟悉它们的来龙去脉 (P.S。我工作在团队建设 Advanced Installer).