Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happen if I delete App.config in C# application?

I write a small application, that I don't need store anything in config files. So the file App.config in my source is exactly what ever Visual Studio has created.
So I want to delete this file from source code (before compiling). But I noticed that it also contains the .NET version information. I wonder if I delete App.config file, then copy my application to other pc, is it have any strange behavior?

like image 983
Thanh Nguyen Avatar asked Dec 31 '13 16:12

Thanh Nguyen


People also ask

What happens if I delete config?

If someone deletes the . config file, it's gone, baby, gone. And it will be necessary to create, deploy, or GET it again. Storing values of default settings - probably two obvious answers would be in a config file or a database table.

Is it safe to delete config files?

Also deleting the configuration files wont do you any harm except when mods suddenly change thier Block/Item Id's and you load an old World with the old Id's blocks might be missing, also beware when using Optifine that you dont delete the "optionsof.

Do I need app config?

config are only required, if you have coded your application in such a way that it is explicitly dependent on it. If you have not done this, or have put error handling/default values or actions in place where it can't read the config file, one would assume your application could run without it.

What is the use of app config?

App. Config is an XML file that is used as a configuration file for your application. In other words, you store inside it any setting that you may want to change without having to change code (and recompiling). It is often used to store connection strings.


1 Answers

I wonder if I delete App.config file, then copy my application to other pc, is it have any strange behavior?

Nope, it should be fine. There are various (somewhat tortuous) rules about exactly what version of the CLR etc gets used in what situations, but for the most part you're fine to just rely on the default behaviour.

You really don't need an app.config file unless you need to give specific settings.

like image 57
Jon Skeet Avatar answered Sep 24 '22 01:09

Jon Skeet