我需要以编程方式访问引导程序的卸载位置。我需要这些信息,因为在卸载过程中,链中的包需要的一些文件需要在所有包成功安装后移动到这里。
我可能需要修改注册表中的UninstallString值到另一个位置,并将引导程序可执行文件和其他所需文件复制到该位置。这样做有什么副作用吗?
您可以使用负载添加所需的文件。这些文件被打包到boostrapper.exe中,并且在执行过程中可以在执行引导程序的同一文件夹中使用。将引导程序应用程序所需的文件添加到引导程序应用程序的有效负载。
<BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
<Payload SourceFile='MyBA.dll' />
<Payload SourceFile='BootstrapperCore.config' />
... place additional playload files here ...
</BootstrapperApplicationRef>
你可以用
从你的引导程序代码中访问它们Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "payloadfilename");
您还可以将文件添加到特定的包中。
<ExePackage InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]""
UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]"" >
<Payload SourceFile="payloadfilename"/>
</ExePackage>