给vs安装项目添加卸载快捷方式
2012-08-17 16:32
323 查看
我的编译器是vs2010
1.新建项目(控制台应用程序,NET版本同你的主程序相同)
2.右击项目》属性》应用程序》应用程序类型》更改为windows窗体应用程序(这么做的目的是为了在运行项目程序时不弹出cmd窗口)
3.修改main函数 如下面所示:
VB.NET
C#
4.生成项目(假设生成的项目文件为Uninstalled.exe)
5.在你的vs安装项目中》文件系统?应用程序文件夹》添加文件》添加Uninstalled.exe , 如下图所示
6.右击Uninstalled.exe 》 创建快捷方式》右击新建的快捷方式》属性》将Arguments值更改为
"-uninstalled" "[ProductCode]" ,其他内容自己设置
如果你还想在程序菜单添加卸载的快捷方式,如上创建快捷方式,指向Uninstalled.exe
7.重新生成vs安装项目,安装试试吧。
1.新建项目(控制台应用程序,NET版本同你的主程序相同)
2.右击项目》属性》应用程序》应用程序类型》更改为windows窗体应用程序(这么做的目的是为了在运行项目程序时不弹出cmd窗口)
3.修改main函数 如下面所示:
VB.NET
Imports System.Text.RegularExpressions Module Module1 Sub Main(args() As String) Try If args.Length = 2 AndAlso args(0) = "-uninstalled" Then '{5E705D88-92D1-4C0C-ADEF-836F41429E7A} If Regex.IsMatch(args(1), "^\{[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\}$", RegexOptions.IgnoreCase) Then Using Process.Start(System.Environment.SystemDirectory & "\msiexec.exe", "/x """ & args(1) & """") End Using End If End If Catch ex As Exception End Try Environment.Exit(0) End Sub End Module
C#
using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Text.RegularExpressions; static class Module1 { public static void Main(string[] args) { try { if (args.Length == 2 && args[0] == "-uninstalled") { //{5E705D88-92D1-4C0C-ADEF-836F41429E7A} if (Regex.IsMatch(args[1], "^\\{[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}\\}$", RegexOptions.IgnoreCase)) { using (Process.Start(System.Environment.SystemDirectory + "\\msiexec.exe", "/x \"" + args[1] + "\"")) { } } } } catch (Exception ex) { } Environment.Exit(0); } }
4.生成项目(假设生成的项目文件为Uninstalled.exe)
5.在你的vs安装项目中》文件系统?应用程序文件夹》添加文件》添加Uninstalled.exe , 如下图所示
6.右击Uninstalled.exe 》 创建快捷方式》右击新建的快捷方式》属性》将Arguments值更改为
"-uninstalled" "[ProductCode]" ,其他内容自己设置
如果你还想在程序菜单添加卸载的快捷方式,如上创建快捷方式,指向Uninstalled.exe
7.重新生成vs安装项目,安装试试吧。
相关文章推荐
- 为VS.NET的部署项目添加卸载快捷方式
- Windows安装项目卸载快捷方式
- dotnet程序安装包添加卸载快捷方式
- VS安装项目生成的快捷方式问题
- winform中为安装程序添加卸载的快捷方式
- VS "安装和部署项目"生成的快捷方式问题
- InstallShield错误:由于添加自动卸载的快捷方式使得无法正确安装和卸载的问题
- winform中为安装程序添加卸载的快捷方式
- winform中为安装程序添加卸载的快捷方式
- Windows安装项目卸载快捷方式
- VS 2008的Setup project项目添加卸载功能
- vs2005代码出现波浪线,卸载项目再添加,一切正常
- Wix学习整理(7)——在开始菜单中为HelloWorld添加卸载快捷方式
- vs.net应用程序图标以及制作安装程序快捷方式图标设置
- 【基础】C#卸载快捷方式添加
- .net 程序安装包卸载快捷方式
- InstallShield中添加一个卸载快捷方式或设置反卸载 - DISK1TARGET
- Wix学习整理(7)——在开始菜单中为HelloWorld添加卸载快捷方式
- Web安装项目创建桌面快捷方式及重写安装类
- Wix学习整理(7)——在开始菜单中为HelloWorld添加卸载快捷方式