如何更改ROOTDRIVE一个CustomAction? [英] How do I change ROOTDRIVE with a CustomAction?

查看:110
本文介绍了如何更改ROOTDRIVE一个CustomAction?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常情况下,您可以更改默认的根驱动器将应用程序安装到使用:

Normally, you can change the default root drive to install your application to using:

<Property Id="ROOTDRIVE">D:\</Property>



但现在,我想用一个被调用于下一个按钮,点击CustomAction去改变它我安装向导:

But now, I wish to change it using a CustomAction that gets called on a next button click in my install wizard:

[CustomAction]
public static ActionResult SetFullInstallRootDrive(Session session) {
    session["ROOTDRIVE"] = session["DRIVE_NAMES"].ToString();
}



DRIVE_NAMES代表选择的驱动器,使用组合框,ROOTDRIVE被正确设置要么不管本地驱动器,我选择(例如, C:\ D:\ )。但是,安装程序始终安装到 D:\ 驱动器最初在属性设置上面。这是怎么回事,我怎么可以在自定义操作动态更改该属性的值,这样我可以让用户选择根驱动器安装我的web应用程序?酒店也得到确定,但它不使用它,它几乎仿佛ROOTDRIVE属性只被计算一次,在安装向导的开始。

DRIVE_NAMES represents the drive selected, using a combo box, and ROOTDRIVE gets properly set to either whatever local drive I choose (in example, C:\ or D:\). However, the installer always installs to the D:\ drive originally set in the property above. What is going on, and how can I change this property's value on the fly in a custom action so that I can let the user select the root drive to install my web application? The property DOES get set, but it doesn't use it, its almost as if the ROOTDRIVE property only gets evaluated once, at the start of the installation wizard.

推荐答案

我能够通过修改TARGETDIR而不是ROOTDRIVE来解决我自己的问题:

I was able to solve my own problem by modifying the TARGETDIR instead of the ROOTDRIVE:

<InstallExecuteSequence>
  <Custom Action="FormatTargetDirectory" After="CostFinalize">NOT Installed</Custom> 
</InstallExecuteSequence> 

<CustomAction Directory="TARGETDIR" Value="[DRIVE_NAMES]" Id="FormatTargetDirectory"/>`

这篇关于如何更改ROOTDRIVE一个CustomAction?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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