4

I have a DLL written in c# which works fine (what it is doing is of no consequence).

I then try and call in from VB6.

Again, all is well.

When I changed the c# code to use the app.config to store configuration data the VB6 code fails.

Now I know that the DLL's in .Net look for the app.config from the calling application, but VB6 does not have this.

Is this something that I have to live with, or is there another way?

gilesrpa
  • 969
  • 1
  • 12
  • 35
  • possible duplicate of [equivalent of app.config for library (dll)](http://stackoverflow.com/questions/5190539/equivalent-of-app-config-for-library-dll) – shf301 Oct 16 '14 at 12:52
  • Thank you for that, but my problem is VB6 calling the DLL. The DLL is looking for the app.config, but VB6 does not ave an app.config file. I did try and copy the config file into the VB6 directory, but it still did not work. – gilesrpa Oct 16 '14 at 12:58
  • What makes you think the DLL is looking for app.config? It's not. It's looking for the config file. That's not the same thing. – John Saunders Oct 16 '14 at 14:39

1 Answers1

5

This is a stab in the dark, and I don't have everything here for me to test this out, but the app.config file is usually renamed into something along the lines of MyApp.exe.config when you are building your MyApp.exe project. The dll is being called by the VB6 application (Let's say it is MyVbApp.exe) try renaming your .config file in the the deployment directory to MyVbApp.exe.config.

John Dahle
  • 244
  • 1
  • 6
  • Tried it with a VB6 .exe that loads a .NET .dll and renaming the config file to `VB6Application.exe.config` works. – helrich Oct 24 '14 at 12:23
  • Yeah, I remember that is the way you do have to do that with a VB6 app. I don't keep VB6 on my laptop usually. – John Dahle Oct 27 '14 at 01:23