从安装部署项目目录 [英] Install directory from deployment projects

查看:185
本文介绍了从安装部署项目目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个应用程序,我将与部署项目的帮助下部署(这是要创建一个安装程序)。

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.

我需要知道这个文件夹就是因为会有保存有一些文件我需要从其他DLL文件使用。我如何通过编程得到这个安装文件夹?

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?

感谢您!

推荐答案

看看在安装类。添加从这个类派生你的应用程序的项目一个新的类。不要忘了应用runInstaller的属性。

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.

在部署项目中,添加自定义操作安装并提交。对于CustomActionData属性为安装自定义操作,输入 / TARGETDIR =[TARGETDIR] \

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屋!

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