Important! This is an automatic machine translated page. If you can read english, you should Click Here to read the original English version of the article.

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!

This article was originally written on 10/17/06 Tagged with: Tento článok bol pôvodne napísaný na 10/17/06 Tagged s: Programming Programovanie

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:


Name: Meno:
Email: E-mail:

Comments (1) Komentáre (1)

  1. renuka Renuka

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


Leave a Comment Zanechať komentár




Leave your Zanechajte svoj friendly priateľský comment here. komentár tu.

If you have a computer help question, Ak máte počítač pomôže otázku, click here to leave it on the forums kliknite tu nechať to na fórach instead. miesto.

Note: Your comment may not show up immediately on the site. Poznámka: Váš komentár sa nezobrazia okamžite na mieste.

Our Friends Naši priatelia
Getting Started Začíname


About How-To Geek O tom, ako-To Geek
What Is That Process? Čo je to za proces?
svchost.exe svchost.exe
jusched.exe jusched.exe
dwm.exe Dwm.exe
ctfmon.exe ctfmon.exe
wmpnetwk.exe wmpnetwk.exe
wmpnscfg.exe WMPNSCFG.exe
rundll32.exe rundll32.exe
wfcrun32.exe wfcrun32.exe
Ipoint.exe Ipoint.exe
Itype.exe Itype.exe
Wfica32.exe Wfica32.exe
Mobsync.exe Mobsync.exe
conhost.exe conhost.exe
Dpupdchk.exe Dpupdchk.exe Adobe_Updater.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. Copyright © 2006-2009 HowToGeek.com. All Rights Reserved. All Rights Reserved.