VS2015 release Packager

1, install  Visual Studio Installer Projects Extension
download and install the normal program

2, using the VS2015 Visual Studio Installer Package

The first step, create an installation project

 

as follows:

  

The leftmost box there are three folders

1. "Applications folder" or "Application Folder" indicates that the file you want to install the application needs to be added;

2. "users 'programs' menu" that "User's Programs Menu" said: After installing the application, the content displayed in the user's "Start Menu" in general in this folder, you need to re-create a file used to store : application .exe and uninstaller .exe;

3. "user desktop" or "User's Desktop", said: After installing the application, .exe create a shortcut on the user's desktop.

 

The second step, right-click "application folder" add - file

 

Exe files are added is generally in the debug file directory has been compiled application program (exe file that is located in the main program ../bin/Debug folder);

After the addition, it is generally required exe program will automatically dependencies also add to the mix, such as various dll file, "Detected Dependencies" on the right side can be seen inside it which automatically import dependency, allowing you to check for missing

Next, the likely left some folders or XML configuration files and so on does not automatically add to the mix, this time need to manually add their own

The same way, right-click "application folder" add - folders, add - file, not repeat them here

PS: Here dependent files if there is a folder, where is the need to add the same folder

 

The third step is to create a shortcut

 

Right main exe file, select "Create Shortcut to ......"

然后,中侧框框里会出现一个快捷方式项,将它剪切,粘贴到"用户桌面"文件夹下

至于快捷方式的名称、图标、描述等其他属性,可以在属性面板中设置,如下

 

第四步,添加卸载程序

 

既然有安装就有卸载,卸载程序其实是一个Windows操作系统自带的程序(C:Windows\System32\Msiexec.exe),只不过是通过给它传特殊的参数命令,来让它执行卸载

添加和设置卸载程序的操作如下:

首先,将卸载程序放在"应用程序文件夹"目录下,右键"应用程序文件夹",添加——文件,在系统盘下找到这个路径文件——C:Windows\System32\Msiexec.exe添加进去

由于Msiexec.exe这个名字不够直观,所以一般接下来我们会对它重命名,一般改为"卸载.exe"或"UnInstall.exe",然后给它创建快捷方式并将快捷方式放到"用户程序菜单"目录下

  

接下来是很关键的一步,设置卸载参数,告诉卸载程序该卸载哪个

首先,找到安装项目的ProductCode,在安装项目的属性面板中可以看到,如下

复制此ProductCode ,粘贴到"卸载.exe"快捷方式的Arguments属性,前面加/x空格,如下

Arguments="/x {81575537-5736-457F-9DBE-857C1F67BE70}"记得/x后面一定要有个空格

 

第五步,其他设置

 

如果还想对安装程序进行其他设置,比如,友化安装欢迎界面,自定制安装步骤,修改注册表,设置启动条件(比如要求必须先安装指定的.net FrameWork版本才可以启动)等,可以右键安装项目,在View中可以进行选择设置,如下

有需要可以再去研究,这里就不详细赘述了

设置默认安装路径

选中Application Folder点击右键,修改安装默认文件夹,可以直接填入

 

第六步,设置系统必备

 

一般我们开发的程序都有一个目标框架,也就是所依赖的.net Framework版本环境,如.net Framework 2.0/3.5/4.0/4.5等

要想我们的程序能在电脑上正常运行,首先就得保证电脑上装有指定的.net Framework版本框架,可以在安装包的属性中设置,启动安装前检查操作系统中是否安装了指定版本的框架或其他依赖,设置方法如下:

右键安装包项目,点开"属性"

然后点击"Prerequisites……"

选择你程序需要的.net Framework版本以及其他依赖项

选择"从组件供应商的网站上下载系统必备组件",这样一来,即使电脑上没有安装需要的.net Framework也不要紧,只要设置了这项,安装程序会自动从微软的官网上下载对应的组件并安装,是不是很方便

  

 

第七步,生成打包安装文件

 

右键安装项目,选择重新生成

然后打开解决方案文件夹下的Debug或Release文件夹,就可以看到生成的安装文件

生成的setup.exe与setup.msi的区别

setup.exe里边包含了对安装程序的一些条件的检测,比如需要.net的版本是否安装等,当条件具备后,setup.exe接着调用setup.msi,而setup.msi则可以直接运行,如果你确定条件都具备的情况下

 

本文链接:https://blog.csdn.net/Firefly_cjd/article/details/77450839

Guess you like

Origin www.cnblogs.com/qq52117354/p/11434031.html