How to Add a Configuration File to your Windows Forms application Kako Add Konfiguracija datotek na vaš Windows Forms uporabe
When you are creating a new Windows Forms application, it isn't immediately obvious how to get a configuration file for your application. Ko ustvarjate novo Windows Forms aplikacijo, ni takoj jasno, kako priti konfiguracijsko datoteko za vašo prijavo. 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. Vaša prijava konfiguracijske datoteke naj se imenuje executablename.exe.config, in bi morali biti v isti imenik kot vaš zahtevek, da bi. NET framework samodejno uporabo.
But when you create the configuration file in the \bin\debug directory, it gets overwritten immediately when you do a new build. Toda, ko boste ustvarili nastavitvene datoteke v \ bin \ debug imenika, da postane prepišete takoj, ko naredite novo zgraditi. That's slightly annoying. To je rahlo nadležno.
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. Ustrezen način za dodajanje te datoteke je dodati novo konfiguracijo novo datoteko z imenom App.config za svoj projekt, ki bo Visual Studio kopirati in preimenovati v isto ime kot izvršljiv vaše ime, ko pa graditi.
There's a really simple way to do this.. Obstaja zelo preprost način za to .. simply go to the File \ Add New Item menu, or hit Ctrl+Shift+A preprosto pojdite na File \ Add Nova postavka menija, ali pritisnite Ctrl + Shift + 
You'll notice that it's already set to App.config for you. Opazili boste, da je že nastavljen na App.config za vas. Just hit the Open button. Samo zadeti gumb Odpri.
If you look in the Solution Explorer, you will see that the config file is in your project: Če pogledaš v Solution Explorer, boste videli, da je config datoteke v vašem projektu:

Now build your application, and take a look in the \bin\debug\ folder. Sedaj graditi vašo prijavo, in se poglej v \ bin \ debug \ mapo. You'll see that the configuration file has automatically been generated and named correctly for your executable: Videli boste, da je zunanja podoba pila je bil samodejno ustvari in pravilno imenovan za vaš izvršljiv:

If you change the name of the outputted file, Visual Studio is smart enough to generate the new filename correctly. Če spremenite ime datoteke outputted, Visual Studio je dovolj pameten, da ustvari novo ime datoteke pravilno.
Enjoy Configuring! Uživajte Konfiguriranje!

Daily Email Updates Dnevni Email Updates
You can get our how-to articles in your inbox each day for free. Lahko dobite našo kako do člankov v vašo mapo »Prejeto vsak dan brezplačno. Just enter your name and email below: Preprosto vpišite vaše ime in e-pošto spodaj:



thank you very much really helpful , thanks a lot najlepša hvala pošteno uslužen, hvala veliko