检测安装程序(msi)软件包的位置 [英] Detecting the location of the installer (msi) package

查看:75
本文介绍了检测安装程序(msi)软件包的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用Visual Studio安装程序项目来开发用于桌面应用程序的安装程序包.我正在使用自定义操作使用户能够提供一些用于配置已安装的应用程序的其他信息.我还希望支持无提示(无人值守)安装.在这种情况下,用户应提供包含必要信息的xml文件.由于我不想强迫用户将文件存储在预定义的位置,因此我需要在自定义操作中检索安装程序包的位置,并检查该文件夹是否包含xml文件.到目前为止,我无法找到一种方法来检索msi程序包的位置.任何想法将不胜感激

Uros

Hi
I am using the visual studio installer project to develop installer package for a desktop application. I am using custom actions to enable the user to provide some additional information used to configure the installed application. I also want to support silent (unattended) installations. In that case the user should provide the xml file holding the necessary info. Since I don''t want to force the user to store the file on the pre-defined location, I need to retrive the location of the installer package within my custom action and check if that folder contains the xml file. So far I was unable to find a way to retrive the location of the msi package. Any ideas would be appreciated

Uros

推荐答案

您最初遇到的问题是,MSI在执行之前先复制到windows\installer目录中

看看 SourceDir [ ^ ]属性
The initial problem you have is that the MSI gets copied to the windows\installer directory before it gets executed

Have a look at the SourceDir[^] property


可以通过以下步骤解决所描述的问题:

-在Visual Studio中,右键单击您的安装程序项目,然后选择查看->自定义操作
-右键单击该阶段的自定义操作(安装,卸载..l),您需要在其中访问msi项目的源目录并选择属性
-在CustomActionData下输入以下行:
Described problem can be solved by the following steps:

-In visual studio right-click your installer project and select view->custom actions
-Right click the custom action for the phase(install, uninstall..l) in which you need to access the source directory of your msi project and select properties
-Enter the following line under CustomActionData:
/sourcedir="[SOURCEDIR]\"

现在,您可以通过以下行访问自定义操作中的源目录:

Now the source dir in your custom action can be accessed by the following line:

Context.Parameters["sourcedir"]


这篇关于检测安装程序(msi)软件包的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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