473,419 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

How to specify the config file for a C# program independent from any project?

As we know, a App.config file can be specified in a C# project in the
.Net IDE. However, how to specify the App.config file for a C# program
independent of any C# project? For example, a.cs is such a C# program
that it can only be compiled by the following command line under Windows
console:

c:> csc a.cs

Seek for your guide.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
3 4804
If you are compiling your app out of VS.NET IDE, still you can specify
configuration with <ApplicationName>.exe.config file which can be placed in
the same directory.

if you have an application abc.exe, the config file for the same will be
abc.exe.config.

Sudhakar Sadasivuni
http://one.mvpblog.com
http://www.mugh.net
"Daniel Xiao" wrote:
As we know, a App.config file can be specified in a C# project in the
.Net IDE. However, how to specify the App.config file for a C# program
independent of any C# project? For example, a.cs is such a C# program
that it can only be compiled by the following command line under Windows
console:

c:> csc a.cs

Seek for your guide.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2
I use a distinct app settings wrapper. See
http://www.west-wind.com/presentatio...ationclass.asp

--

HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Concept S2i inc.(www.s2i.com)
"Daniel Xiao" <xi*******@yahoo.com> wrote in message
news:ey**************@TK2MSFTNGP14.phx.gbl...
As we know, a App.config file can be specified in a C# project in the
Net IDE. However, how to specify the App.config file for a C# program
independent of any C# project? For example, a.cs is such a C# program
that it can only be compiled by the following command line under Windows
console:

c:> csc a.cs

Seek for your guide.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #3
>As we know, a App.config file can be specified in a C# project in the
Net IDE. However, how to specify the App.config file for a C# program
independent of any C# project?


You'd have to use one of the many third-party, extended, enhanced
..config file handlers. The standard .NET configuration system doesn't
provide any means of using anything but the app's "MyApp.exe.config"
(or web.config for ASP.NET) file.

You might want to check out www.codeproject.com and search for ".NET
configuration" or something like that - there are tons of alternatives
out there.

Marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Nov 16 '05 #4

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

Similar topics

3
by: Simon | last post by:
Hi everyone, I really need help with the following: It's common in app development to create numerous projects under one solution that as a whole combine to become your final application. For...
4
by: Thomas Koch | last post by:
Hi - I would like to load other files relative to the application config file. Do anyone know if this is possible? If I do Environment.CurrentDirectory it will work if the program is launched...
9
by: ALI-R | last post by:
Hi,, I have two questions : 1) Is it mandatory that config file of a desktop application must be App.config 2) Is it possible to update config file in your code?? thanks for your help. ALI
8
by: Henry | last post by:
Hi, in a Windows form VB.Net project I use localization for all texts. In App.Config I added: <appSettings> <add key="locale" value="de"/> </appSettings> In the project I have ressource...
1
by: Joseph Geretz | last post by:
I need to download a greater than 4 megabyte attachment via WSE / DIME. The only way I know how to configure this is via a .config file. Normally, the ..config file is the same name as the base...
3
by: Richard Lewis Haggard | last post by:
I have a test application that is calling an assembly that reads some strings out of a config file. Normally, this assembly supports a web application and the information can be read just fine....
8
by: aabdis | last post by:
Hello All.... I have a question... i have two Windows apps (one UI, and one service) which use a common DLL that hands out database results and such to the two apps. The DLL always connects to...
0
by: Brian Vanderburg II | last post by:
Lance Gamet wrote: Lance Gamet wrote: One way I've just started to use it to create a utility function to return the location of the user data folder, depending on the operating system: import...
3
by: Jeff | last post by:
I have a solution with two projects. Project A is the startup project, while Project B serves as the project with the data logic. At run time, the first thing I need to do is write to Project...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.