In .NET, after building a project, why do I sometimes have an app.config and other times a binaryname.dll.config file?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You see it as app.config file during development (in Visual Studio). When deployed (as well as in your bin directory), app.config becomes binaryname.dll/exe.config file (automatically renamed by Visual Studio).
As for the exact reason…there is a good reason not to have it as app.config…for example, if you deploy several applications in the same directory, you would be able to have only one app.config…so there is a good reason to name it binaryname.dll.config.
So the real question is: why is it named app.config and not binaryname.dll.config in the first place?
One of the reasons I can think of is that you can always change your binary output name in project options (so compiler generates .exe file with a name different than your project name), and config file will be copied to correspond to that binary output name. Having it named app.config in the solution is better because you always copy the same file name to some destination file name, without a need to rename that file in solution (which is good especially when that file is under source control). There might be some other reason as well.