can i put 2 configuration files for my Console application ?

G

Guest

Hi all,

I want to give a sample console application for the user with 2
configuration files.
I want to give also a 2 .bat files for running the sample application, one
for each configuration file.
How can i choose in the .bat file which configuration file to use ?
(something like myApp.exe -D file1.config).

Thanks.
 
G

Guest

i don't know how to run myApp.exe once with file1.config and once with
file2.config as the configuration file (without copying file1.config or
file2.config to myApp.exe.config).
 
P

Pohihihi

no you can't do that. but what you can do is that you can change the name of
config file to run with another config file.
 
P

Pohihihi

When you compile your application you get a config file with the name of exe
file and config as extension (assuming you have added app.config in your
project). now you can have 2 files wiht different settings e.g.

1- application.exe.config
2- application.exe.config.notinuse

now when you have to use config file #2 then you can change the name of #1
to something like application.exe.config.notinusenow and you can change the
#2 as application.exe.config

now when you will run your application #2 config file will be used.
other way could be that you read second config file (which is nothing more
than xml file) and using xml features in language you can read the tags and
values. little involved process but might work for the settings you are
needing.

just wondering, what is the diff between two files youhave?
 
G

Guest

ok, got you, i hope that there was other option like myApp.exe -D file1.config.

Thanks a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top