Why is app.config not added after installation from the Windows installer?

I have a windows application developed using Visual Studio 2008 (C #). It has an app.config file that stores various configuration related data. After creating the installer for the project and installing it, the app.config file will not be copied to the installed directory. However, functions that rely on the settings in this file seem to work.

Now one of these parameters is the database connection string, which obviously needs to be changed when installed on another PC. My question is: how to get the app.config file with the installation file so that it can be configured later?

+3
source share
2 answers

app.config is copied / renamed <assembly name> .config as part of the compilation process and placed in the bin directory. If you are using the Visual Studio installer project (blech!), Then it should also have picked it up and included in the installer, IIRC.

(In response to your comment on both answers)

You cannot use it as "app.config". The .NET configuration system is looking for a configuration file whose name matches the name of the entry. If you rename the file back to "app.config", the configuration classes will stop working.

+6
source

app.config . - myapp.exe, app.config myapp.config myapp.exe.config.

, , .

+1

Source: https://habr.com/ru/post/1778904/


All Articles