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 Kuinka Lisää konfigurointitiedostoa Windows Lomakkeet

When you are creating a new Windows Forms application, it isn't immediately obvious how to get a configuration file for your application. Kun luot uuden Windows Lomakkeet, se ei ole välittömästi selvää, miten saada kokoonpano tiedoston hakemuksesi. 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. Hakemuksesi konfiguraatiotiedosto pitäisi olla nimeltään executablename.exe.config, ja pitäisi olla samassa hakemistossa kuin hakemuksen, jotta. NET Frameworkin automaattisesti käyttämään sitä.

But when you create the configuration file in the \bin\debug directory, it gets overwritten immediately when you do a new build. Mutta kun luot kokoonpano tiedosto \ bin \ debug-hakemistoon, se saa päälle heti, kun teet uuden rakentaa. That's slightly annoying. Se hieman harmittaa.

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. Oikea tapa lisätä tämän tiedoston lisätä uusia uuden kokoonpanon tiedoston nimeltä App.config projektiin, joka Visual Studio automaattisesti kopioida ja nimetä on sama nimi kuin oman suoritustiedoston nimi, kun teet rakentaa.

There's a really simple way to do this.. On olemassa todella yksinkertainen tapa tehdä tämä .. simply go to the File \ Add New Item menu, or hit Ctrl+Shift+A yksinkertaisesti mene File \ Add New Item-valikosta, tai paina Ctrl + Shift +

You'll notice that it's already set to App.config for you. Huomaat, että se on jo asetettu App.config sinulle. Just hit the Open button. Painaa Avaa-painiketta.

If you look in the Solution Explorer, you will see that the config file is in your project: Jos et katso Solution Explorer, huomaatte, että config-tiedosto on projektissa:


Now build your application, and take a look in the \bin\debug\ folder. Nyt rakentaa oman hakemuksen ja ottaa katso \ bin \ debug \ kansio. You'll see that the configuration file has automatically been generated and named correctly for your executable: Huomaat, että asetustiedosto on automaattisesti luotu ja nimetty oikein sinun executable:

If you change the name of the outputted file, Visual Studio is smart enough to generate the new filename correctly. Jos muutat nimeä outputted tiedoston, Visual Studio on fiksu, että se synnyttää uutta tiedostonimeä oikein.

Enjoy Configuring! Nauti Configuring!

This article was originally written on 10/17/06 Tagged with: Tämä artikkeli on alun perin kirjoitettu 10/17/06 Tagged kanssa: Programming Ohjelmointi

Daily Email Updates Päivittäinen päivitykset

You can get our how-to articles in your inbox each day for free. Voit saada myös ohjeartikkeleita postilaatikossa joka päivä ilmaiseksi. Just enter your name and email below: Anna nimesi ja sähköpostiosoitteesi alla:


Name: Nimi:
Email: Email:

Comments (1) Kommentit (1)

  1. renuka Renuka

    thank you very much really helpful , thanks a lot Paljon kiitoksia todella hyödyllistä, kiitos paljon


Leave a Comment Jätä kommentti




Leave your Jätät friendly ystävällisen comment here. kommentoida täällä.

If you have a computer help question, Jos sinulla on tietokone apua kysymys, click here to leave it on the forums klikkaa tästä jättää sen foorumeilla instead. sen sijaan.

Note: Your comment may not show up immediately on the site. Huomaa: Kommentti ei välttämättä näy heti sivuilla.

Our Friends Ystävämme
Getting Started Alkutoimista


About How-To Geek Tietoja How-To Geek
What Is That Process? Mikä tuo prosessiin?
svchost.exe svchost.exe
jusched.exe winampa.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. Kaikki oikeudet pidätetään.