🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Can I move .exe.config file?

Started by
4 comments, last by Prototype 4 years, 1 month ago

Hi,

My VS Windows project pulls in 5 packages and therefore creates 5 DLL files next to the executable. I think this looks ugly so I have moved the DLLs to a subfolder and use the <probing> configuration to point to the subfolder to load the DLLs. This works fine, but I now have to have the .exe.config file next to the main executable for this to work. If I move this file, the app doesn't start.

Is it possible to move the .exe.config into a subfolder too?

Advertisement

Not as far as I'm aware of. The reason is simple, the OS needs to lookup the file when the executable starts and as same as .dll lookup is done for a fixed set of paths that are defined by the PATH environment variable (on Windows), it performs the same lookup at those paths for the config file. You can for example relocate all your .dlls by adding the subfolder to the PATH variable but why do you care about?

Projects like the Unreal Engine have an entire folder of hundrets of .dll and exe files alltogether and no-one complains about it. have you thought about static linking instead of using .dll files (in C++ for example)?

Treat the exe.config file as if it were a conjoined twin of the corresponding exe file: somewhat separate, but it cannot be in a different place.

If you care about having the minimum possible number of confusing files user-visible folders, put the exe, its config and its DLL family in a “bin” or “lib” subfolder and a batch file (containing a command similar to ~dp0/bin/whatever.exe -option) in the main folder.

Omae Wa Mou Shindeiru

Thank you both, very useful ?

LorenzoGatti said:

If you care about having the minimum possible number of confusing files user-visible folders, put the exe, its config and its DLL family in a “bin” or “lib” subfolder and a batch file (containing a command similar to ~dp0/bin/whatever.exe -option) in the main folder.

This is what I most usually do, it's more tidy and makes it obvious to the user which icon to click to run the program.

This topic is closed to new replies.

Advertisement