开发者

Startup same .exe file with different app.config 's

开发者 https://www.devze.com 2023-04-09 04:59 出处:网络
I开发者_如何学Pythons there a way (maybe from command line) to start the same exe file twice using a different app config?var configMap = new ExeConfigurationFileMap();

I开发者_如何学Pythons there a way (maybe from command line) to start the same exe file twice using a different app config?


var configMap = new ExeConfigurationFileMap();
configMap.ExeConfigFilename = @"myconfigpath";
var config = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None);


Start it from a separate location, where the filename.exe.config is different.


THe configuration framework let you load the config from any file but you will have to handle that manually from within your application.

Look at ConfigurationManager class


You can load your process into a separate app domain. This allows you to redirect the configuration file. See http://www.codeproject.com/KB/IP/HostingMultipleServices.aspx for an example of doing this with a Windows service. It'll be similar for any kind of application.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号