Subscribe to How-To Geek Mag-subscribe sa Paano-Upang Geek

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 Paano Magdagdag ng isang Configuration File na iyong Windows Forms application

When you are creating a new Windows Forms application, it isn't immediately obvious how to get a configuration file for your application. Kapag kayo ay lumilikha ng isang bagong Windows Forms application, ito ay hindi agad-agad halata kung paano makakuha ng isang configuration file para sa iyong application. 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. Ang iyong aplikasyon configuration file ay dapat na tinatawag na executablename.exe.config, at dapat sa parehong directory ng iyong aplikasyon sa order para sa. NET framework upang awtomatikong gamitin ito.

But when you create the configuration file in the \bin\debug directory, it gets overwritten immediately when you do a new build. Ngunit kapag ikaw ay gumawa ng mga configuration file sa \ bin \ debug direktoryo, ito ay makakakuha ng mapapatungan kaagad kapag gagawin mo ang isang bagong build. That's slightly annoying. Iyan ay bahagyang nakakainis.

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. Ang tamang paraan upang idagdag ang file na ito ay upang magdagdag ng bagong mga bagong configuration file na tinatawag na App.config sa iyong mga proyekto, kung saan ang Visual Studio ay awtomatikong kopyahin at palitan ang pangalan sa parehong pangalan bilang iyong maipapatupad na ang pangalan ko kapag ka ng isang build.

There's a really simple way to do this.. May isang tunay simpleng paraan upang gawin ito .. simply go to the File \ Add New Item menu, or hit Ctrl+Shift+A lamang na pumunta sa File \ Add New Item menu, o pindutin ang Ctrl + Shift + A

You'll notice that it's already set to App.config for you. Mapapansin mo na ito ay naka-set sa App.config para sa iyo. Just hit the Open button. Pindutin lamang ang pindutan ng Buksan.

If you look in the Solution Explorer, you will see that the config file is in your project: Kung titingnan mo sa solusyon Explorer, makikita mo na ang config file ay sa iyong mga proyekto:


Now build your application, and take a look in the \bin\debug\ folder. Ngayon magtayo ang inyong aplikasyon, at kumuha ng tumingin sa \ bin \ debug \ folder. You'll see that the configuration file has automatically been generated and named correctly for your executable: Makikita mo na ang mga configuration file ay awtomatikong nalikha at pinangalanan ng tama para sa iyong mga maipapatupad na:

If you change the name of the outputted file, Visual Studio is smart enough to generate the new filename correctly. Kung binago mo ang pangalan ng outputted file, Visual Studio ay matalino na sapat na upang makabuo ng bagong filename ng tama.

Enjoy Configuring! Enjoy-configure!

This article was originally written on 10/17/06 Tagged with: Ang artikulong ito ay orihinal na isinulat sa 10/17/06 Tagged with: Programming Programming

Daily Email Updates Araw-araw na Updates Email

You can get our how-to articles in your inbox each day for free. Maaari kang makakuha ng aming kung-paano na mga artikulo sa iyong inbox sa bawat araw para sa libre. Just enter your name and email below: Ilagay lamang ang inyong pangalan at email sa ibaba:


Name: Pangalan:
Email: Email:

Comments (1) Comments (1)

  1. renuka renuka

    thank you very much really helpful , thanks a lot thank you very much talagang helpful, thanks a lot


Leave a Comment Iwanan ng isang Puna




Leave your Iwanan ang iyong mga friendly friendly comment here. puna dito.

If you have a computer help question, Kung ikaw ay may isang computer ng tulong tanong, click here to leave it on the forums i-click dito upang mag-iwan ito sa forums instead. sa halip ng.

Note: Your comment may not show up immediately on the site. Tandaan: Ang iyong puna ay maaaring hindi magpapakita agad sa site.

Our Friends Ang aming mga Friends
Getting Started Pagsisimula


About How-To Geek Tungkol sa Paano-Upang Geek
What Is That Process? Ano ba ang Proseso Iyon?
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.