VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

时间:2023-03-09 05:15:02
VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

Microsoft Visual Studio 2017 Installer Projects

SkyRiN发表于Coding+订阅
253
VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

助力数字生态,云产品优惠大促

腾讯云促销,1核1G 99元/1年,2核4G 1200元/3年

立即抢购

这是一个易于发布 VS 项目的官方插件,以下是简要使用介绍。

1.安装插件

VS 工具栏 > 工具 > 扩展和更新 > 联机 > 搜索 Microsoft Visual Studio 2017 Installer Projects 并安装。安装完成后需要重启 VS。

2.添加 Setup 解决方案

右击解决方案 > 添加 > 新建项目

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

其它项目类型 > 安装项目 > 自定义名称 > 确定

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

3.配置安装项目

设置Setup

完成以上操作后,在解决方案资源管理器中选中 CenterSetup 配置其属性

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

以下几个属性比较重要:

KEY

VAL

Author

一般填公司名,会使用其作为软件安装目录名

Localization

指定软件运行地语种,如果你的软件是多语言的话

TargetPlatform

指定软件目标平台 x86 or x64

Version

发布版本号

桌面快捷方式

右击 CenterSetup (Application Folder) > add > 项目输出 > 选择主输出确定,完成后如下:

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

选中 User's Desktop 在右边 Name 一栏下右击 > 创建新的快捷方式 > 选择 Application Folder > 选择刚才创建的主输出

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

1

这里创建的快捷方式会生成到桌面,名称可以自定义

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

2

开始菜单快捷方式

下面的 User's Programs Menu 和上面一样创建快捷方式,这个快捷方式会出现在开始菜单栏,需要提到的是,可以在这里创建一个子目录来存放项目安装文件,例如Tencent 旗下有 QQ、QQLive、QQBrowser 等多个产品,如果没有子目录那么这些软件的安装文件都会被放到 Tencent/ 目录下,所以这里应该是这样的

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

设置快捷方式Icon

先在 Application Folder 下添加一个 ico 文件

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)
VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

选中 User's Desktop 下的快捷方式,在属性一栏设置 Icon 为刚才添加进来的 ico 文件,开始菜单快捷方式同理

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

生成安装文件.msi

右击 CenterSetup 生成

VS2017 winform 打包 安装(使用 Microsoft Visual Studio 2017 Installer Project)

生成的安装文件位于 工程目录/CenterSetup/Release(Debug)/ 下。