473,473 Members | 4,204 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Windows App: [ConfigurationSettings.AppSettings]

Hi there,
I am writing a Windows App and need a Configuration file.

I wonder if I can use the WEB.CONFIG file to store my values.
I also wonder if I can use the ConfigurationSettings.AppSettings and if so,
what is the file name that it automatically look for.

Thanks,
Filippo
Nov 15 '05 #1
3 3110
Filippo,
Within a Windows App, the web.config is called app.config, you continue to
use ConfigurationSettings.AppSettings to get values &
ConfigurationSettings.GetConfig to get custom sections.

Within your VS.NET project you need to add your config file to your VS.NET
project's root folder as app.config, it needs to be named "app.config"
without the quotes. When you
build your project VS.NET (both 2002 & 2003) will copy the app.config file
from the project root to your output folder and name it appropriately
(myproject.exe.config).

It is important that you add the file to your VS.NET project as app.config.
While when you deploy your app you call it myproject.exe.config where
myproject is the name of your executable, and myproject.exe.config is in the
same folder as your exe.

Hope this helps
Jay
"Filippo" <pa********@hotmail.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
Hi there,
I am writing a Windows App and need a Configuration file.

I wonder if I can use the WEB.CONFIG file to store my values.
I also wonder if I can use the ConfigurationSettings.AppSettings and if so, what is the file name that it automatically look for.

Thanks,
Filippo

Nov 15 '05 #2
The config file can be named either app.config or yourappname.exe.config

Jay B. Harlow [MVP - Outlook] wrote:
Filippo,
Within a Windows App, the web.config is called app.config, you continue to
use ConfigurationSettings.AppSettings to get values &
ConfigurationSettings.GetConfig to get custom sections.

Within your VS.NET project you need to add your config file to your VS.NET
project's root folder as app.config, it needs to be named "app.config"
without the quotes. When you
build your project VS.NET (both 2002 & 2003) will copy the app.config file
from the project root to your output folder and name it appropriately
(myproject.exe.config).

It is important that you add the file to your VS.NET project as app.config.
While when you deploy your app you call it myproject.exe.config where
myproject is the name of your executable, and myproject.exe.config is in the
same folder as your exe.

Hope this helps
Jay
"Filippo" <pa********@hotmail.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
Hi there,
I am writing a Windows App and need a Configuration file.

I wonder if I can use the WEB.CONFIG file to store my values.
I also wonder if I can use the ConfigurationSettings.AppSettings and if


so,
what is the file name that it automatically look for.

Thanks,
Filippo



Nov 15 '05 #3
Jonathan,
Please read what I said, it cannot be called yourappname.exe.config in the
VS.NET project! Period! (Actually it can but it will not be copied, so what
good is it?)

Also if you are using VS.NET 2003 it has to be in the root folder of your
VS.NET project, as VS.NET 2003 will replace any config file in your output
folder (the output folder is normally bin) to ensure that the copy in your
bin folder matches the Supported Runtimes setting under the Project Property
Pages.

VS.NET 2002 supports the app.config in your project root, however VS.NET
2002 does not remove it from the output folder.

Try it, I have.

Hope this helps
Jay

"Jonathan" <da***********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
The config file can be named either app.config or yourappname.exe.config

Jay B. Harlow [MVP - Outlook] wrote:
Filippo,
Within a Windows App, the web.config is called app.config, you continue to use ConfigurationSettings.AppSettings to get values &
ConfigurationSettings.GetConfig to get custom sections.

Within your VS.NET project you need to add your config file to your VS.NET project's root folder as app.config, it needs to be named "app.config"
without the quotes. When you
build your project VS.NET (both 2002 & 2003) will copy the app.config file from the project root to your output folder and name it appropriately
(myproject.exe.config).

It is important that you add the file to your VS.NET project as app.config. While when you deploy your app you call it myproject.exe.config where
myproject is the name of your executable, and myproject.exe.config is in the same folder as your exe.

Hope this helps
Jay
"Filippo" <pa********@hotmail.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
Hi there,
I am writing a Windows App and need a Configuration file.

I wonder if I can use the WEB.CONFIG file to store my values.
I also wonder if I can use the ConfigurationSettings.AppSettings and if


so,
what is the file name that it automatically look for.

Thanks,
Filippo


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Guinness Mann | last post by:
I'm working in VS2003.NET, with C#. I use app.config to store the connection string to my SQL Server. This works fine. Lately I've been taking work home where the connection string is...
2
by: Anatoly | last post by:
I'm trying to use VB.NET's 2003 ConfigurationSettings.AppSettings.Set() method of updating values but getting error "Collection is read-only". How can I change values of keys in the App.config...
6
by: Sean | last post by:
Hi, I am developing a windows .NET apps to be used in several countries with different languages and I want to use a configuration file to retrieve the fields in the right language depend on the...
3
by: Danny | last post by:
Hello, I was wondering if anyone knew if it was possible to make changes to an application's App.config file at runtime and then be able to access those changes immediately. The following is...
12
by: JSheble | last post by:
I've written a Windows Service using C#, but I cannot seem to figure out how to cancel or prevent the service from starting under certain conditions. For example, in the OnStart I read in some...
3
by: PMac | last post by:
I'm trying to execute a stand-alone console application from an aspx page when a use clicks a button on that page. On the aspx page is the following lines of pertinent code: private void...
3
by: Fredrik Elestedt | last post by:
Hi, I've been trying to use FormsAuthentication agains windows users and groups - not Active Directory. I couldn't find any articles on this directly, not to say that there aren't any out...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
2
by: bz | last post by:
Hi, I have a library project that implements a Business Layer for a web and a desktop application All my business classes are in this lib, so I have here the connection string to database as...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.