How to Add a Configuration File to your Windows Forms application Jak dodać plik konfiguracyjny do aplikacji 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. Podczas tworzenia nowej aplikacji Windows Forms, to nie jest oczywiste, jak się plik konfiguracji aplikacji. 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. Plik konfiguracji aplikacji ma się nazywać executablename.exe.config, i powinny być w tym samym katalogu co aplikacja w celu. NET automatycznie go użyć.
But when you create the configuration file in the \bin\debug directory, it gets overwritten immediately when you do a new build. Jednak podczas tworzenia pliku konfiguracyjnego \ bin \ debug katalogu, dostaje natychmiast zastępowane podczas wykonywania nowych konstrukcji. That's slightly annoying. To trochę denerwujące.
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. Właściwy sposób, aby dodać ten plik, aby dodać nowy nowy plik konfiguracyjny o nazwie App.config do projektu, który Visual Studio automatycznie skopiować i zmienić nazwę na taką samą nazwę jak nazwa pliku wykonywalnego, kiedy nie budować.
There's a really simple way to do this.. Jest bardzo prosty sposób to zrobić .. simply go to the File \ Add New Item menu, or hit Ctrl+Shift+A iść do pliku \ menu Add New Item, lub naciśnij Ctrl + Shift + 
You'll notice that it's already set to App.config for you. Zauważysz, że jest już ustawiona App.config dla Ciebie. Just hit the Open button. Wystarczy nacisnąć przycisk Otwórz.
If you look in the Solution Explorer, you will see that the config file is in your project: Jeśli spojrzysz w Solution Explorer, widać, że plik konfiguracyjny jest w projekcie:

Now build your application, and take a look in the \bin\debug\ folder. Teraz budowy aplikacji i spojrzeć w \ bin \ debug \ teczka. You'll see that the configuration file has automatically been generated and named correctly for your executable: Zobaczysz, że plik konfiguracyjny został wygenerowany automatycznie i prawidłową nazwę dla pliku wykonywalnego:

If you change the name of the outputted file, Visual Studio is smart enough to generate the new filename correctly. Po zmianie nazwy pliku outputted, Visual Studio jest wystarczająco inteligentny, aby wygenerować nowy plik poprawnie.
Enjoy Configuring! Konfiguracja Enjoy!

Daily Email Updates Daily Email Updates
You can get our how-to articles in your inbox each day for free. Możesz pobrać nasze instrukcje postępowania w skrzynce odbiorczej codziennie za darmo. Just enter your name and email below: Wystarczy podać swoje imię i adres e-mail:



thank you very much really helpful , thanks a lot dziękuję bardzo bardzo pomocne, dziękuję