如何从Native C ++中读取App.Config [英] How Do I Read App.Config From Native C++

查看:102
本文介绍了如何从Native C ++中读取App.Config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个应用程序。它使用原生c ++包装C#dll,dll正在从app.config读取appsetting。如果我运行本机C ++程序,当我在c#dll中执行类似的操作时返回null:



myapp.Browser = System.Configuration.ConfigurationManager.AppSettings [浏览器];



myapp.Browser为空。



我的问题是我必须在visual studio中为app.config文件设置任何东西,以便设置myapp.Browser?



谢谢

Hi guys,

I have a app. it is using native c++ wrapping a C# dll and the dll is reading appsetting from app.config. if i run the native C++ program it return null when i do something like this in the c# dll:

myapp.Browser = System.Configuration.ConfigurationManager.AppSettings["Browser"];

the myapp.Browser is null.

my question is do i have to set anything in visual studio for the app.config file in order to have myapp.Browser set?

thanks

推荐答案

使用AppDomain.CurrentDomain.SetupInformation.ConfigurationFile查找应用程序配置文件。

它返回文件路径,但找不到文件
used AppDomain.CurrentDomain.SetupInformation.ConfigurationFile to find the app config file.
it returned the file path, but can't find the file


这篇关于如何从Native C ++中读取App.Config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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