当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - How do I get my application to choose between two app.config files?

问题描述:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: