Pro Tip: Don’t co-opt .net conventions for your own purposes


Right.

So it turns out that the visual studio/.net convention of assembly.extension.config for config files is NOT to be used for your own devices outside of visual studio.

Example:

Today I made an app called whatever.client.exe. It needed to read an xml file for some config, but I didn’t want to use Visual Studio to generate that config, and I didn’t want the Properties.Settings.Default stuff, for reasons beyond the scope of this post I just wanted to load the xml config file and parse it myself.

Easiest way to do this I thought was name it whatever.client.exe.config and load it by looking at Application.ExecutablePath and appending a “.config”.

No dice. Dropping a file with that name in the executing directory of the app caused the app to fail to launch with the message “…failed to start because its side by side configuration is incorrect”. Ok then. Even if you just create an xml named with that convention in the application directory, and don’t involve visual studio at all, it still dies.

The fix is just name it something else of course, and everything is fine. Learn something new every day I guess.

Edit

Ok so Tomas Restrepo was kind enough to point out that this is a OS convention that is just being used by .net, so it’s not .net app-specific. See Here for further information.

Technorati Tags:

,

VMWare Fusion Shared Folders and Visual Studio Development