简体   繁体   中英

Reading app.config of a VB6 project from a C# dll library

I need to create a C# .NET DLL library that can read all the project configurations from a config file.

The main project was written in VB6, that calls my C# DLL library.

I created a test method that returns a cabled string and the call works correctly, so the VB6 to C# integration works.

My problem is that I use the System.Configuration.ConfigurationManager class to read the configuration file (App.config). It works if the call come from a C# test project but it doesn't work if the call became from VB6 project.

I think that the problem is caused by VB6 that don't read App.config file as project configuration file, how I can do that?

The problem is solved: I tried to rename App.config in myVB6AppName.exe.config but it doesn't work. The solution is including myVB6AppName.exe.config file in VB6 project as document. Now it works!

如果您在调试模式下运行 VB6,请记住将您的 app.config 作为 VB6.exe.config 放在 VB6.exe 所在的文件夹中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM