如何从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