开发者

How I can use an app.config file with a comvisible class library?

开发者 https://www.devze.com 2022-12-10 12:19 出处:网络
I\'m wo开发者_运维百科rking on this ComVisible class library that uses a third party component.This component needs some settings to be added to the config file.Since the application that uses my dll

I'm wo开发者_运维百科rking on this ComVisible class library that uses a third party component.This component needs some settings to be added to the config file.Since the application that uses my dll is a VB 6 application I don't know where should I put the config file? is there anyway that we can load a config file at runtime?


You can put the app.config in the same directory as the VB6 app (named (yourapp).exe.config). If you want to load it at runtime, you'll have to write an unmanaged shim that starts the CLR and loads your managed code in a new appdomain- then you can tell it to load whatever config file you want for the new appdomain. This is a pain though (having done it a few times)... There are some options for managed shims as well (see the AppDomainManager class for details).


If you just need "a config file" and not specifically the app.config, this post shows a simple class model that I use to store configuration values:

(.Net) suggestions on making a config file for a program?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号