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! הגדרת תיהנו!

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



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