473,503 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to force an .EXE to use a different app.config file?

How can I force an .EXE to use a different app.config file?
For instance, I have an MyApp.exe which by default uses MyApp.exe.config
file. Can I force it to use ThatApp.exe.config?

Thanks
Nov 17 '05 #1
3 3423
Hi Frank,

I think it's close to impossible - as far as I know, the algorithm for
loading <appname>.exe.config files is hard-coded and cannot be changed.
For more flexibility, consider using Microsoft Configuration Management
Application Block.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Frank Rizzo" <no**@none.com> wrote in message
news:uq*************@TK2MSFTNGP09.phx.gbl...
How can I force an .EXE to use a different app.config file?
For instance, I have an MyApp.exe which by default uses MyApp.exe.config
file. Can I force it to use ThatApp.exe.config?

Thanks


Nov 17 '05 #2
Frank Rizzo wrote:
How can I force an .EXE to use a different app.config file?
For instance, I have an MyApp.exe which by default uses
MyApp.exe.config file. Can I force it to use ThatApp.exe.config?


You _could_ create a small .NET startup EXE which takes the other EXE and
your preferred config file as command line parameters... then create a new
app domain in the small config file, load the other EXE into the new app
domain, reset the config file to the preferred config file for that app
domain, then execute the Main command in the loaded EXE file.

But I wouldn't waste my time, personally, as I'm not sure what advantage
that would grant. Maybe you're trying to start multiple versions of an exe
each with a different configuration? You could have multiple directories,
each with a different config, but the same EXE, or you could pass the
alternate config file on the command line and parse it "manually" (which
really is easy since it's XML anway.)

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
Nov 17 '05 #3
Dmytro Lapshyn [MVP] wrote:
Hi Frank,

I think it's close to impossible - as far as I know, the algorithm for
loading <appname>.exe.config files is hard-coded and cannot be changed.
For more flexibility, consider using Microsoft Configuration Management
Application Block.


I think it is possible, given that NAnt build files provide an option to
run NUnit tests via a different .config file.
Nov 17 '05 #4

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

Similar topics

3
2575
by: Mustaq | last post by:
Hi, How to read same config file from different application? I have 4 application in VB.NET, all are using different app.config files. NOW I need all to read only one config file, how can I do...
6
7476
by: manatlan | last post by:
I've got a trouble, and i think that anybody there can help me I've got a python script which i distribute in somes packages for *nix. This script is full of python and need python 2.4 ! And i'd...
4
2411
by: Benne Smith | last post by:
In our company, i have three servers; 1) a development server (mine only - here i make daily changes and test my stuff) 2) a test server (for the users to test milestone builds - changes weekly)...
0
1229
by: Andy | last post by:
Hi all, I'd like to have an App.config file for development, then when I build the deployment package (using one of the VS.net projects), i'd like to specify a different .config file to install...
3
2281
by: Stuart Read | last post by:
Hi, - I'm running .NET framework 1.1 on win2k server I'm investigating error pages at the moment. I have found how to: a) display friendly or real .NET errors in the remote browser, by...
5
2683
by: =?Utf-8?B?VGhlIE1hbiBGcm9tIFNRTA==?= | last post by:
I'm having the darndest XML config file problem that I really need help with. I'm supporting a .NET 1.1 desktop application with its own config file, and I implement IConfigurationSectionHandler...
11
2258
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Is there a way in ASP.NET 2.0 to have different connection strings settings in a web.config files that are dynamically used based upon the server that the web application is running on? For...
1
3814
by: Daniel | last post by:
how to force a .net application to use .net 2.0 ? this windows service is about 4 years old and im pretty sure is using .net 1.x runtime. Is there soem setting in the installer that says to use...
0
1906
by: david12842 | last post by:
I already have a mysqld running on port 3306 on my linux system and want a second instance on a different port. This is a totally different instance, I don't want it to share data tables or anything...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7281
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
7334
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
6993
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
7462
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...
0
5579
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
4675
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...
0
3168
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
383
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...

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.