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 כיצד להוסיף קובץ תצורת היישום-Windows Forms שלך

When you are creating a new Windows Forms application, it isn't immediately obvious how to get a configuration file for your application. כאשר אתה יוצר חדש טפסים יישום של Windows, זה לא ברור מיד איך לקבל קובץ תצורה עבור היישום. 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. קובץ תצורת היישום שלך אמור להיקרא executablename.exe.config, ואת צריכה להיות באותה ספרייה של היישום שלך כדי המסגרת. NET כדי להשתמש בו באופן אוטומטי.

But when you create the configuration file in the \bin\debug directory, it gets overwritten immediately when you do a new build. אבל כאשר אתה יוצר את קובץ התצורה לפח \ \ debug בספרייה, זה נעשה מוחלפים מיד כאשר אתה חדש לבנות. That's slightly annoying. זה קצת מעצבן.

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. הדרך הנכונה להוסיף קובץ זה להוסיף תצורה חדשה קובץ חדש בשם App.config לפרויקט שלך, אשר-Visual Studio להעתיק באופן אוטומטי כדי לשנות שם זהה לשם ההפעלה שלך כאשר אתה עושה לבנות.

There's a really simple way to do this.. יש דרך ממש פשוטה לעשות את זה .. simply go to the File \ Add New Item menu, or hit Ctrl+Shift+A פשוט ללכת קובץ \ הוסף פריט חדש בתפריט, או להכות Ctrl + Shift +

You'll notice that it's already set to App.config for you. שים לב כי זה כבר נקבע ל App.config בשבילך. Just hit the Open button. פשוט ללחוץ על כפתור פתח.

If you look in the Solution Explorer, you will see that the config file is in your project: אם תסתכל הפתרון אקספלורר, תראה את הקובץ config הוא בפרוייקט שלך:


Now build your application, and take a look in the \bin\debug\ folder. עכשיו לבנות את הבקשה שלך, ולהסתכל לפח \ \ debug \ תיקייה. You'll see that the configuration file has automatically been generated and named correctly for your executable: תראה את הקובץ באופן אוטומטי לתצורה זו היה שנוצר בשם כראוי עבור ההפעלה שלך:

If you change the name of the outputted file, Visual Studio is smart enough to generate the new filename correctly. אם תשנה את שם הקובץ outputted, Visual Studio הוא חכם מספיק כדי ליצור את שם הקובץ החדש בצורה נכונה.

Enjoy Configuring! הגדרת תיהנו!

This article was originally written on 10/17/06 Tagged with: מאמר זה נכתב במקור ב 10/17/06 עם שתייגת: Programming תכנות

Daily Email Updates שערי עדכונים בדוא"ל

You can get our how-to articles in your inbox each day for free. אתה יכול לקבל כמה שלנו למאמרים לתיבת הדואר שלך בכל יום בחינם. Just enter your name and email below: פשוט להזין את שם ואת הדוא"ל שלך להלן:


Name: שם:
Email: דואר אלקטרוני:

Comments (1) תגובות (1)

  1. renuka renuka

    thank you very much really helpful , thanks a lot תודה רבה לך באמת מועיל, תודה רבה


Leave a Comment השאירו תגובה




Leave your השאירו שלך friendly ידידותי comment here. תגובה כאן.

If you have a computer help question, אם יש לך מחשב לעזור השאלה, click here to leave it on the forums לחץ כאן כדי להשאיר אותו על פורומים instead. במקום.

Note: Your comment may not show up immediately on the site. הערה: ההערה שלך לא תופיע מיד באתר.

Our Friends חברים שלנו
Getting Started התחלת העבודה


About How-To Geek אודות How-To Geek
What Is That 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. זכויות יוצרים © 2006-2009 HowToGeek.com. All Rights Reserved. כל הזכויות שמורות.