本文介绍了Wix Bootstrapper卸载快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建卸载卸载程序的快捷方式.因此,我只想做与添加和删除程序时的卸载相同的事情.

I am trying to create shortcuts to uninstalling whatever the bootstrapper has installed.So simply i want to do the same thing as the uninstall does when going to Add and remove programs.

我发现de bootstrapper安装在程序包缓存中{guid} [bootstrappername] .exe

I found that de bootstrapper is installed in package cache{guid}[bootstrappername].exe

它安装的msi软件包之一也会安装该bootstrapper/uninstall调用的快捷方式.但是,问题在于,每次构建都会重新生成软件包的GUID.所以我有些必须设置为一个msi属性.但是我不知道该怎么做,在我看来,GUID在构建期间不知道,只有在构建完成之后才知道?

One of the msi packages that it installs also installs a shortcut to this bootstrapper /uninstall call.However problem is that the GUID of the package is regenerated on every build. So i some how have to set it asa msi property.But i cannot figure out how to do this, seem to me that the GUID is not known during building but only after build is done?

还有另一种方法来确定缓存的引导程序的位置吗?

is there another way to determine the location of the cached bootstrapper ?

推荐答案

如果您使用的是托管BA,则可以尝试以下操作:

If you are use Managed BA you can try this:

在与MsiPackage链接的Bundle.wxs中,添加MsiProperty,如:

In your Bundle.wxs in chain with MsiPackage add MsiProperty like:

<MsiPackage SourceFile="Setup.msi"> <MsiProperty Name="UNINSTALLER_PATH" Value="[UNINSTALLER_PATH]"/></MsiPackage>

<MsiPackage SourceFile="Setup.msi"> <MsiProperty Name="UNINSTALLER_PATH" Value="[UNINSTALLER_PATH]"/></MsiPackage>

在代码中的某处(在调用安装操作之前),您需要为此变量设置值,如下所示:Engine.StringVariables["UNINSTALLER_PATH"] = string.Format(@"{0}\{1}\{2}\{3}.exe", Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Package Cache", Engine.StringVariables["WixBundleProviderKey"], ProductName);

Somewhere in code (before call install action), you need set value for this variable like this:Engine.StringVariables["UNINSTALLER_PATH"] = string.Format(@"{0}\{1}\{2}\{3}.exe", Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Package Cache", Engine.StringVariables["WixBundleProviderKey"], ProductName);

Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)–%systemdir%:\ ProgramData的路径

Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) – path to %systemdir%:\ProgramData

Package Cache- ProgramData中安装软件包缓存的文件夹名称

Package Cache- folder name in ProgramData where installing bundle caching

Engine.StringVariables ["WixBundleProviderKey"] –通过缓存捆绑包创建的文件夹(GUID)的名称

Engine.StringVariables["WixBundleProviderKey"] – name of folder (guid) created by caching bundle

ProductName –您的引导程序"exe"的名称

ProductName – name of your bootstrapper "exe"

最后,您可以在Product.wxs中创建常用的快捷方式,但是在"Target"属性中,您需要传递UNINSTALLER_PATH值和"Arguments"设置="/uninstall":

And finally in your Product.wxs you can create shortcut usual way, but in "Target" attribute you need pass UNINSTALLER_PATH value and "Arguments" set ="/uninstall":

<Shortcut Id="Shortcut1" Name="Uninstall" Description="Uninstall" Target="[UNINSTALLER_PATH]" Arguments="/uninstall" WorkingDirectory="Programmenufolder" />

对不起,我的英语:)

这篇关于Wix Bootstrapper卸载快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-12 12:15