c++ cli - How to use user.config in c++ cli -
i tired of googling how use user.config instead of app.config in managed c++ application. found c# , can't figurate out how translate c++ (properties namespace not exist)
anybody can put me in way learn that? need know how create, read , write user.config file.
thank you
follow steps , work desired:
1 - add reference system.configuration
2 - add new item
> visual c++
> utility
> configuration file
3 - open app.config
, add settings example:
<configuration> <appsettings> <add key="greeting" value="hallo world!" /> </appsettings> </configuration>
4 - copy app.config
output folder in post build event: goto project properties
> configuration properties
> build events
> post-build events
> command line
, add this:
copy app.config "$(targetpath).config"
5 - read settings:
string^ greeting = configurationmanager::appsettings["greeting"]; console::writeline(greeting);
here's appconfigdemo project in c++/cli
.
Comments
Post a Comment