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 Kaip pridėti konfigūracijos failą Windows Forms taikymo

When you are creating a new Windows Forms application, it isn't immediately obvious how to get a configuration file for your application. Kai kuriate naują Windows formų taikymą, ji nėra iš karto akivaizdu, kaip pasiekti konfigūracijos failo jūsų paraišką. 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ūsų prašymas konfigūracijos failas turėtų būti vadinamas executablename.exe.config, ir turi būti tame pačiame kataloge, kaip jūsų paraiška siekiant,. NET Framework automatiškai juo naudotis.

But when you create the configuration file in the \bin\debug directory, it gets overwritten immediately when you do a new build. Tačiau kurdami konfigūracijos failą \ bin \ debug katalogą, ji bus perrašyta iš karto, kai Jūs naujos statybos. That's slightly annoying. Tai šiek tiek erzina.

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. Tinkamu būdu įtraukti šio failo pridėti naujus nauja konfigūracijos failą App.config į savo projektą, "Visual Studio bus automatiškai nukopijuoti ir pervadinti į tokį patį pavadinimą kaip savo vykdomąjį vardą, kai jūs statyti.

There's a really simple way to do this.. Yra labai paprastas būdas tai padaryti .. simply go to the File \ Add New Item menu, or hit Ctrl+Shift+A tiesiog eikite į File \ Add New Item meniu, arba paspauskite Ctrl + Shift +

You'll notice that it's already set to App.config for you. Jūs pastebėsite, kad ji jau nustatyta App.config jums. Just hit the Open button. Tiesiog paspauskite Atidaryti.

If you look in the Solution Explorer, you will see that the config file is in your project: Jei pažvelgti į Solution Explorer, matysite, kad konfigūracijos failas yra jūsų projektas:


Now build your application, and take a look in the \bin\debug\ folder. Dabar pastatyti savo paraišką, ir atsižvelgti į \ bin atrodyti \ debug \ aplanką. You'll see that the configuration file has automatically been generated and named correctly for your executable: Pamatysite, kad konfigūracijos failas yra automatiškai generuojami ir pavadinta teisingai savo vykdomąjį:

If you change the name of the outputted file, Visual Studio is smart enough to generate the new filename correctly. Jei pakeisti outputted failo pavadinimas, "Visual Studio yra pakankamai protingas, kad sukurti naują failo pavadinimą teisingai.

Enjoy Configuring! Mėgaukitės konfigūravimas!

This article was originally written on 10/17/06 Tagged with: Šis straipsnis buvo parašytas ant 10/17/06 Tagged with: Programming Programavimas

Daily Email Updates Dienos paštas Atnaujinimai

You can get our how-to articles in your inbox each day for free. Galite gauti mūsų kaip prie straipsnių į Jūsų pašto dėžutę kasdien nemokamai. Just enter your name and email below: Tiesiog įveskite vardą ir elektroninio pašto adresą žemiau:


Name: Vardas:
Email: Paštas:

Comments (1) Komentarai (1)

  1. renuka renuka

    thank you very much really helpful , thanks a lot Thank you very much really helpful, Thanks a lot


Our Friends Mūsų draugai
Getting Started Paruo


About How-To Geek Apie How-To Geek
What Is That Process? Kas yra šis procesas?
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.