从部署项目安装目录 [英] Install directory from deployment projects
问题描述
在一个在安装程序中,它将允许用户更改应用程序的安装文件夹。
我需要知道这个文件夹是什么,因为会有一些文件保存在我需要从另一个DLL文件使用。如何以编程方式获取此安装文件夹?
谢谢!
p>查看安装程序类。将从此类派生的新类添加到应用程序的项目中。不要忘记应用RunInstaller属性。
在部署项目中,为安装和提交添加自定义操作。对于安装自定义操作的CustomActionData属性,输入 / Targetdir =[TARGETDIR] \
。
在您在应用程序项目中创建的安装程序类中,覆盖安装方法,在此方法中可以得到如下安装目录:
string targetDir = Context.Parameters [TargetDir];
I'm developing an application and I'm going to deploy it with the help of a deployment project (which is gonna create an installer).
At one step in the installer, it will allow the user to change the installation folder for the application.
I need to know what this folder is because there will be some files saved there that I need to use from another DLL file. How can I programmatically get this installation folder?
Thank you!
Take a look at the Installer class. Add a new class derived from this class to your application's project. Don't forget to apply the RunInstaller attribute.
In your deployment project, add a Custom Action for Install and Commit. For the CustomActionData property for the Install custom action, enter /Targetdir="[TARGETDIR]\"
.
In your Installer class that you created in the application's project, override the Install method, and in this method you can get the installation directory like this:
string targetDir = Context.Parameters[ "TargetDir" ];
这篇关于从部署项目安装目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!