10

I have a .net interop project that uses an app.config file. When I am running the VB6 project that is using the interop control in Debug mode, the ConfigurationManager cannot find the app.config file. When I make the VB6 project into an exe and rename the app.config file to (VB6 binary name).exe.config, the ConfigurationManager can find the file.

Is there a way to rename the app.config file or change a setting so ConfigurationManager can find the app.config file while VB6 is running in debug mode?

5
  • You say- "compile the VB6 project into an exe and rename the app.config file to (VB6 binary name).exe.config, the ConfigurationManager can find the file." How are you running the VB6 project if you're not compiling it to an exe? Commented Oct 7, 2008 at 23:59
  • If you have any control over the .NET project you should really remove it's use of the .config file as this is a terrible terrible idea. If a program in \program files loads it, you'll need to stick the config there, which means you'll need to be an admin. it's all a big pile of fail Commented Oct 8, 2008 at 0:03
  • I agree about not using the config file but that is a decision made above me. Commented Oct 8, 2008 at 0:05
  • I am running the VB6 project using Run > Start F5; however, this is when the app.config file cannot be found. When I make the project using File > make prj.exe, it finds the app.config file. Commented Oct 8, 2008 at 0:07
  • @Muadite - ok gotcha...Alexander Kojevnikov is correct, when debugging the VB6 environment debugger (vb6.exe) is the kicking off exe so .net will be looking for vb6.exe.config in the VB6 exe folder. Commented Oct 8, 2008 at 0:12

1 Answer 1

17

A dirty hack is to place the app.config file into the VB6 folder and rename it to vb6.exe.config

Sign up to request clarification or add additional context in comments.

5 Comments

That only works when I make the exe, not while I am debugging it
Do you rename it to <your application>.exe.config? What I mean is you need to put it to "C:\Program Files\Microsoft Visual Studio\VB98\VB6.EXE.config". VB6 is the host process when debugging, that trick should work (you will probably need to reload VB6 though)
@Alexander Kojevnikov That worked. I am sorry I doubted you. I didn't know about the VB6.exe. Thank you.
I try the same way but it's not working for me. Any other suggestions?
You also need to restart VB6 if it was running

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.