473,804 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows App: [ConfigurationSe ttings.AppSetti ngs]

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 ConfigurationSe ttings.AppSetti ngs and if so,
what is the file name that it automatically look for.

Thanks,
Filippo
Nov 15 '05 #1
3 3136
Filippo,
Within a Windows App, the web.config is called app.config, you continue to
use ConfigurationSe ttings.AppSetti ngs to get values &
ConfigurationSe ttings.GetConfi g 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.c onfig where
myproject is the name of your executable, and myproject.exe.c onfig is in the
same folder as your exe.

Hope this helps
Jay
"Filippo" <pa********@hot mail.com> wrote in message
news:u$******** ******@tk2msftn gp13.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 ConfigurationSe ttings.AppSetti ngs 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 ConfigurationSe ttings.AppSetti ngs to get values &
ConfigurationSe ttings.GetConfi g 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.c onfig where
myproject is the name of your executable, and myproject.exe.c onfig is in the
same folder as your exe.

Hope this helps
Jay
"Filippo" <pa********@hot mail.com> wrote in message
news:u$******** ******@tk2msftn gp13.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 ConfigurationSe ttings.AppSetti ngs 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******** ********@TK2MSF TNGP10.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 ConfigurationSe ttings.AppSetti ngs to get values &
ConfigurationSe ttings.GetConfi g 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.c onfig where
myproject is the name of your executable, and myproject.exe.c onfig is in the same folder as your exe.

Hope this helps
Jay
"Filippo" <pa********@hot mail.com> wrote in message
news:u$******** ******@tk2msftn gp13.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 ConfigurationSe ttings.AppSetti ngs 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
20251
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 different. I deal with this by having app.config.home and app.config.work files which I copy over the app.config file as required by my location.
2
9559
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 file programatically? Here is my code: Imports System.Configuration Imports System.Collections.Specialized
6
18208
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 selected country. I saw that on a web apps but I am not sure if I can do the same on a win apps. If someone have an idea of how to do that or give me an example about it, it would be really appreciated
3
7077
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 an example of what I'm trying to achieve: I tried a test by creating a simple app Test.exe that has some basic settings made available to it in the runtime file Test.exe.config.
12
2782
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 configuration settings, and if anything is either empty, or invalid (such as a DB DataSource string or a missing diredtory, etccc) I don't want the servie to start. So how would I cancel the start up?
3
364
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 btnStartApp(object sender, System.EventArgs e) { Process procID; string procName; ProcessStartInfo psi = new ProcessStartInfo();
3
1237
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 there, if you know of one - please let me know. Anyways - the problem I'm having is that only Administrators can logon, probably since they're the only ones allowed to open users and groups (even their own user account). The code I've used is as...
4
4186
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 check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
2
18144
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 app setting (in app.config The section in app.config looks like this <applicationSettings>
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5529
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
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 we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.