问题描述:

I want to create two app.config files and let the user decide which one to use by a command line argument. How do I get my application to use one .config or the other within my code?

I am using a Settings file which is set by the config file. There are two possible configurations and it would be easier if the user could just type ">myprogram -live" or ">myprogram -test" and the program select which config file to load from. Thanks!

网友答案:

Copy two of your exe files with different names:

myprogram.live.exe
myprogram.live.config
myprogram.test.exe
myprogram.test.config

And then you can choose to start myprogram.live or myprogram.test.

相关阅读:
Top