Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using app.config with Interop Controls

Tags:

.net

interop

vb6

I have a .net project (MySolution.Common) that uses the app.config. I am using the project MySolution.Common in an InteropUserControl project called MySolution.InteropCtrl. MySolution.InteropCtrl is embedded into a VB6 project. When the MySolution.InteropCtrl is in the VB6 project, It cannot find the app.config file. Everything in the InteropControl works in VB6 except for what depends on the information in the app.config file. What do I need to change so the MySolution.InteropCtrl can see the app.config file while in VB6?

like image 574
wusher Avatar asked Oct 06 '08 20:10

wusher


2 Answers

I'm not 100% sure on this. But I'll throw out some possibilities. First of all, app.config is not the correct name for the file. While it is app.config in your project, it gets auto-renamed to binary.exe.config or binary.dll.config (depending on project type) where binary is the name of the project.

Secondly, I'm not 100% sure if dll.config files are always properly loaded and read by .NET when the application loads. I don't believe it happens automatically, and that there is an extra call you have to make to read the config file if its for the dll. If you reneame the config file to match your exe, then it will definitely load and be available to you.

like image 106
Nick Avatar answered Oct 13 '22 22:10

Nick


Beth Massi has a blog post that describes how to use a config file for an Interop Control with VB 6.0.

http://blogs.msdn.com/bethmassi/archive/2007/10/24/using-my-settings-and-wcf-configuration-with-the-interop-forms-toolkit.aspx

like image 29
Rob Windsor Avatar answered Oct 13 '22 23:10

Rob Windsor