再弄EXE文件的App.Config中 [英] Get the App.Config of another Exe

查看:316
本文介绍了再弄EXE文件的App.Config中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 App.Config中文件exe文件。现在我想创建一个围绕以消耗一些功能的EXE一个包装DLL。

I have an exe with an App.Config file. Now I want to create a wrapper dll around the exe in order to consume some of the functionalities.

现在的问题是我怎么能访问在app.config属性的EXE ?从包装DLL

The question is how can I access the app.config property in the exe from the wrapper dll?

也许我应该多一点点我的问题,我有以下的app.config内容的exe文件:

Maybe I should be a little bit more in my questions, I have the following app.config content with the exe:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="myKey" value="myValue"/>
  </appSettings>
</configuration>



现在的问题是如何如何从包装DLLmyvalue的了呢?

The question is how to how to get "myValue" out from the wrapper dll?

感谢您的解决方案。

其实我最初的概念是为了避免XML文件读取方法或LINQ或什么的。我首选的方案是使用配置管理库和像

Actually my initial concept was to avoid XML file reading method or LINQ or whatever. My preferred solution was to use the configuration manager libraries and the like.

我会感激,它使用通常与访问的app.config性能相关联的类的任何帮助。

I'll appreciate any help that uses the classes that are normally associated with accessing app.config properties.

推荐答案

一些测试后,我发现了一个办法做到这一点。

After some testing, I found a way to do this.


  1. app.config文件添加到测试项目。使用添加为链接选项。

  2. 使用 System.Configuration.ConfigurationManager.AppSettings [的myKey] 来访问值

  1. Add the App.Config file to the test project. Use "Add as a link" option.
  2. Use System.Configuration.ConfigurationManager.AppSettings["myKey"] to access the value.

这篇关于再弄EXE文件的App.Config中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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