如何从 VS 2017 创建 .msi 或 setup.exe

How do I create an .msi or setup.exe from VS 2017

我正在尝试为 WPF 桌面应用程序创建安装包。我已经安装了 Visual Studio 安装程序并想使用安装向导。它似乎只创建 MSM 或 CAB 安装。我真的想要一个 .msi 或 setup.exe 作为输出。使用 MS Visual Studio 安装程序是否可行,还是我必须添加其他工具?

您应该使用安装项目类型,而不是向导。这将为您提供 IDE 到 Windows 安装程序 MSI 构建。虽然这是旧的,但这些项目多年来没有改变:

https://www.red-gate.com/simple-talk/dotnet/visual-studio/getting-started-with-setup-projects/

如果您的设置需要安装先决条件,您实际上只需要 setup.exe,它会在安装同时创建的 MSI 文件之前完成。

您确实可以使用 Visual Studio Installer Project type in Visual Studio 2017, but the whole tool is not recommended due to .

创建 MSI 文件

如果您坚持使用此项目类型,那么您只需像这样创建一个“安装项目”,您应该能够编译 MSI 文件。

我将尝试将您发送到之前的两个答案,其中包含有关替代方案的更多详细信息:

  • Simplified MSI Tools List

  • How to create windows installer

上面列出的所有工具都可以很好地创建 MSI 文件。