我已经为MyProgram安装了一个安装程序,但它创建的卸载快捷方式留下了空文件夹 [英] I have made an installer for MyProgram but the uninstall shortcut that it creates leaves behind empty folders

查看:157
本文介绍了我已经为MyProgram安装了一个安装程序,但它创建的卸载快捷方式留下了空文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Visual Studio安装程序(Visual Studio安装程序)为MyProgram创建了一个安装程序。它被称为MyProgram Setup.msi。它安装程序正常,如果使用添加/删除程序控制面板卸载,那么所有内容都应该被删除。

I have created an installer for MyProgram using the Visual Studio Installer (Visual Studio Setup Project). It is called "MyProgram Setup.msi". It installs the program fine and if it is uninstalled using the Add/Remove Programs control panel then everything gets removed as it should.

问题是要在用户程序菜单下添加名为卸载MyProgram的程序快捷方式。我尝试以3种不同的方式执行此操作,并且在所有3种方式中,如果使用该快捷方式卸载MyProgram,则卸载将留下2个空文件夹(...程序Files \MyCompany\和... Program Files\MyCompany\MyProgram\)。

The problem is that I want to add a shortcut to the "User's Programs Menu" under the program shortcut called "Uninstall MyProgram". I have tried doing this in 3 different ways and in all 3 ways if MyProgram is uninstalled using that shortcut, the uninstall will leave behind 2 empty folders ("...Program Files\MyCompany\" and "...Program Files\MyCompany\MyProgram\").

以下是我尝试过的3种方法做一个卸载程序快捷方式:

Here are the 3 ways that I have tried to make an uninstaller shortcut:

1)批处理或脚本文件的快捷方式

卸载MyProgram.bat:

Uninstall MyProgram.bat:

@ECHO OFF
msiexec /uninstall {MyGUID}

卸载MyProgram.vbs:

Uninstall MyProgram.vbs:

Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("START /B msiexec /uninstall {MyGUID}")
Set objShell = Nothing

2)使用Orca.exe编辑MSI文件

我发现如何使用本指南: http://www.codeproject.com/KB/install/MSIShortcuts.aspx

I found out how to do this using this guide: http://www.codeproject.com/KB/install/MSIShortcuts.aspx

我将快捷方式条目添加到快捷方式表中。卸载工作,但使用此快捷方式仍然留下2个空文件夹。

I added the Shortcut Entry to the Shortcut table. Uninstalling worked but it still left behind the 2 empty folders when using this shortcut.

3)从MyProgram.exe

我修改了MyProgram.exe以执行/ uninstall命令行参数,以运行msiexec.exe / uninstall {MyGUID}并退出本身。与此解决方案类似: http://www.codeproject.com/KB/install/DeployUninstall .aspx

I modified MyProgram.exe to take a "/uninstall" command line parameter to run "msiexec.exe /uninstall {MyGUID}" and exit itself. Similar to this solution: http://www.codeproject.com/KB/install/DeployUninstall.aspx

这些尝试都没有创建一个可以卸载程序的快捷方式以及程序的基本文件夹。我不想切换到其他安装程序产品,如Inno Setup,NSIS或WiX。

None of these attempts created a shortcut which can uninstall the program as well as the program's base folders. I don't want to switch to some other installer product such as Inno Setup, NSIS, or WiX.

推荐答案

这是Visual Studio安装程序中的一个错误。我决定使用 WiX 。它能够创建具有正确功能的卸载快捷方式。

It seems that this is a bug in the Visual Studio Installer. I have decided to use WiX instead. It is able to create the uninstall shortcut with correct functionality.

这篇关于我已经为MyProgram安装了一个安装程序,但它创建的卸载快捷方式留下了空文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆