如何检查安装过程中是否修改了安装路径? [英] How to check whether installation path is modified during Installation process?

查看:100
本文介绍了如何检查安装过程中是否修改了安装路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在安装过程中使用< g class ="中的自定义操作检查安装路径是否被修改gr_ gr_80 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins replaceWithoutSep"数据-GR-ID =" 80 QUOT; ID = QUOT; 80 QUOT;>视觉及LT; / g取代;
Studio设置部署项目。如果已修改,则卸载应用程序。 

How to check whether installation path is modified during Installation process using custom action in <g class="gr_ gr_80 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins replaceWithoutSep" data-gr-id="80" id="80">Visual</g> Studio setup deployment project. If it is modified then uninstalled the application. 

推荐答案

您好,

您可以获取安装路径在自定义操作中,执行以下步骤:

You can get the installation path in the Custom Actions with the following steps:

步骤1 :通过右键单击将主要输出添加到"安装"选项:

Step 1: Add your primary output to the Install selection by righting click:

第2步:然后将 / DIR ="[TARGETDIR] \" 添加到CustomActionData属性中:

Step 2: Then add /DIR="[TARGETDIR]\" to the CustomActionData property:

第3步:在您的网站上添加安装类project并获取如下路径:

Step 3: Add a install class to your project and get the path as below:

    [RunInstaller(true)]
    public class MyInstaller : Installer
    {
        public override void Install(System.Collections.IDictionary stateSaver)
        {
            base.Install(stateSaver);
            string path = this.Context.Parameters["DIR"];
            
            // Do something with path.
        }
    }

参考:  在安装过程中获取应用程序路径。

Refer: Getting Application path during the installation.

实际上,如果您不希望用户更改路径,可以删除对话框直接在用户界面视图中:

Actually if you do not want user to change the path, you can delete the dialog directly in the User Interface view:

希望这会有所帮助!

最好的问候,

Stanly


这篇关于如何检查安装过程中是否修改了安装路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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