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 Kā pievienot konfigurācijas fails Windows Forms pieteikumu

When you are creating a new Windows Forms application, it isn't immediately obvious how to get a configuration file for your application. Kad veidojat jaunu Windows Forms pieteikumu, tas nav uzreiz skaidrs, kā iegūt konfigurācijas failā jūsu pieteikumu. 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. Jūsu pieteikums konfigurācijas fails ir paredzēts saukt executablename.exe.config, un jābūt tajā pašā direktorijā, kā savu pieteikumu, lai. NET Framework automātiski izmantot.

But when you create the configuration file in the \bin\debug directory, it gets overwritten immediately when you do a new build. Bet kad tu izveidot konfigurācijas failu \ bin \ Debug directory, tā izpaužas pārrakstīti uzreiz, kad tu jaunu objektu būvniecību. That's slightly annoying. Tas ir nedaudz kaitinošas.

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. Pareizā veidā pievienot šo failu pievienot jaunus jaunas konfigurācijas failu ar nosaukumu App.config savam projektam, kas Visual Studio automātiski kopēt un pārdēvēt to pašu nosaukumu, kā Jūsu izpildāmā vārdu, kad jūs būvēt.

There's a really simple way to do this.. Tur ir tiešām vienkāršs veids, kā to .. simply go to the File \ Add New Item menu, or hit Ctrl+Shift+A vienkārši doties uz File \ Add New Item izvēlni, vai nospiediet Ctrl + Shift +

You'll notice that it's already set to App.config for you. Jūs ievērosiet, ka tas jau ir App.config jums. Just hit the Open button. Just hit pogas Atvērt.

If you look in the Solution Explorer, you will see that the config file is in your project: Ja jūs Skatīt Solution Explorer, jūs redzēsiet, ka konfig fails ir jūsu projektā:


Now build your application, and take a look in the \bin\debug\ folder. Tagad veidot savu pieteikumu un veikt skatās \ bin \ Debug \ mapē. You'll see that the configuration file has automatically been generated and named correctly for your executable: Jūs redzēsit, ka konfigurācijas fails ir automātiski tiek iegūta un nosauc pareizi jūsu izpildāmā:

If you change the name of the outputted file, Visual Studio is smart enough to generate the new filename correctly. Ja maināt nosaukumu outputted fails, Visual Studio ir pietiekami gudrs, lai radītu jaunu faila nosaukumu pareizi.

Enjoy Configuring! Enjoy konfigurēšana!

This article was originally written on 10/17/06 Tagged with: Šis pants tika sākotnēji rakstīts uz 10/17/06 tagged with: Programming Programmēšana

Daily Email Updates Daily Email Updates

You can get our how-to articles in your inbox each day for free. Jūs varat saņemt mūsu how-to rakstus savā pastkastītē katru dienu par brīvu. Just enter your name and email below: Vienkārši ievadiet jūsu vārdu un e-pasta zemāk:


Name: Vārds:
Email: E-pasts:

Comments (1) Komentāri (1)

  1. renuka renuka

    thank you very much really helpful , thanks a lot thank you very much patiešām noderīga, pateicoties daudz


Leave a Comment Leave Comment




Leave your Atstājiet savu friendly draudzīgs comment here. komentārus šeit.

If you have a computer help question, Ja Jums ir dators palīdzēt jautājumu, click here to leave it on the forums click here to atstāt uz forumu instead. vietā.

Note: Your comment may not show up immediately on the site. Piezīme: Jūsu komentārs var neparādīties pat tieši uz vietas.

Our Friends Our Friends
Getting Started Getting Started


About How-To Geek Par How-To Geek
What Is That Process? Kas ir šis process?
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.