How to Add a Configuration File to your Windows Forms application Ako pridať do konfiguračného súboru aplikácie Windows Forms
When you are creating a new Windows Forms application, it isn't immediately obvious how to get a configuration file for your application. Pri vytváraní novej Windows Forms aplikácie, to nie je okamžite jasné, ako sa dostať do konfiguračného súboru pre vašu aplikáciu. Your application configuration file is supposed to be called executablename.exe.config, and should be in the same directory as your application in order for the .NET framework to automatically use it. Váš konfiguračný súbor aplikácie má byť tzv executablename.exe.config, a mala by byť v rovnakom adresári ako vaša žiadosť, aby. NET Framework automaticky použiť.
But when you create the configuration file in the \bin\debug directory, it gets overwritten immediately when you do a new build. Ale keď si vytvoriť konfiguračný súbor \ bin \ debug adresár, dostane prepísaný okamžite, keď si novú verziu. That's slightly annoying. To je trochu otravné.
The proper way to add this file is to add new new configuration file called App.config to your project, which Visual Studio will automatically copy and rename to the same name as your executable's name when you do a build. Správny spôsob, ako pridať do tohto súboru je pridanie novej nový konfiguračný súbor s názvom App.config pre váš projekt, ktorý Visual Studio automaticky kopírovať a premenovať na rovnaký názov ako vaše meno spustiteľného keď to build.
There's a really simple way to do this.. Tam je naozaj jednoduchý spôsob, ako to urobiť .. simply go to the File \ Add New Item menu, or hit Ctrl+Shift+A prosto pristúpiť k súboru \ Pridať novú položku menu, alebo stlačte Ctrl + Shift + 
You'll notice that it's already set to App.config for you. Všimnite si, že je už na App.config pre vás. Just hit the Open button. Stačí kliknúť na tlačidlo Otvoriť.
If you look in the Solution Explorer, you will see that the config file is in your project: Pozriete Ak sa v Solution Exploreru, uvidíte, že konfiguračný súbor je v projekte:

Now build your application, and take a look in the \bin\debug\ folder. Teraz stavať svoje aplikácie, a pozrite sa do zložky \ bin \ debug \ leporelo. You'll see that the configuration file has automatically been generated and named correctly for your executable: Uvidíte, že súbor, ktorý bol vygenerovaný automaticky a správne pomenovaný pre vaše spustiteľný:

If you change the name of the outputted file, Visual Studio is smart enough to generate the new filename correctly. Ak zmeníte názov súboru outputted, Visual Studio je dosť šikovný na vytvorenie nového súboru správne.
Enjoy Configuring! Konfigurácia Enjoy!

Daily Email Updates Denný Svářeč
You can get our how-to articles in your inbox each day for free. Môžete si naše jak-na články vo vašej schránky každý deň zadarmo. Just enter your name and email below: Stačí zadať svoje meno a e-mail nižšie:



thank you very much really helpful , thanks a lot děkuji moc naozaj užitočné, díky moc