Visual Studio 2013安装程序扩展 - 如何通过自定义操作执行.reg / .config文件 [英] Visual Studio 2013 installer extension - How to execute .reg/.config file through custom action

查看:162
本文介绍了Visual Studio 2013安装程序扩展 - 如何通过自定义操作执行.reg / .config文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好


目前我们正在创建新的安装程序包,我们要求在安装产品时执行配置文件。您能告诉我我们如何实现这一目标。


这里是详细要求 -


管理员可以使用  .exe文件创建配置本地他的本地计算机然后导出为.config文件并将此文件复制到.msi文件的同一文件夹中。安装程序在安装时执行此文件。因此终端系统将获得
这些配置。


在安装时自定义操作中是否可以将参数发送到.exe? 


谢谢,


Rahul



解决方案

嗨Rahul,


>>""如何通过自定义操作执行.reg / .config文件"


.config文件是纯文本文件。我们不需要执行它。


>>"管理员可以在本地本地计算机上使用< .exe文件创建配置,然后导出为.config文件"


您的意思是管理员会创建新的配置文件并替换现有的配置文件吗?如果是,您只需要获取应用程序安装路径并替换此路径中的.config文件。

 [RunInstaller(true)] 
public partial class CustomInstaller:System.Configuration.Install.Installer
{
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
string path = this.Context.Parameters [" targetdir"];
//在安装路径中替换您的配置文件
}
}

最好的问候,

李旺


Hi

Currently we are creating new installer package and we have requirement to execute configuration file while installing the product. Can you please tell me how can we achieve this.

here is the detail requirement -

Administrator can create configuration using  .exe file on local his local machine and then export as .config file and  copy this file at same folder at .msi file. installer execute this file at the time of installation. so end system will get these configuration.

Is this possible to send parameter to .exe  in custom action at the time of installation? 

Thanks,

Rahul

解决方案

Hi Rahul,

>>"How to execute .reg/.config file through custom action"

.config file is a plain text file. We don't need to execute it.

>>"Administrator can create configuration using  .exe file on local his local machine and then export as .config file "

Do you mean that the Administrator will create a new config file and replace the exist one? If yes, you just need to get the application install path and replace the .config file in this path.

 [RunInstaller(true)]
 public partial class CustomInstaller : System.Configuration.Install.Installer
 {
     public override void Install(System.Collections.IDictionary stateSaver)
     {
         base.Install(stateSaver);
         string path = this.Context.Parameters["targetdir"];
         //replace your config file in install path
     }
 }

Best Regards,
Li Wang


这篇关于Visual Studio 2013安装程序扩展 - 如何通过自定义操作执行.reg / .config文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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