0

I have a web application where I need to launch a console application or exe using ProcessStartInfo class like this -

var app = new ProcessStartInfo
        {
            FileName = @"C:\Projects\...\App.exe"
        };
Process.Start(app);

My understanding is that this exe would use the default App.exe.config (Correct me if I am wrong!). I want the web application to use the settings available in web.config instead. Please advise.

  • Seems like the simplest method is just to copy the settings to the app.config - there's not a simple way to force an app to use a different config file. – D Stanley Mar 28 '16 at 13:14

2 Answers2

0

You can pass parameters to your .exe as part of the ProcessStartInfo. Or you can perhaps pass it a path to a config file to load as a parameter. Or the path to the web.config could be a setting in your App.exe.config. And it your app then looks up settings values from there.

ManoDestra
  • 6,325
  • 6
  • 26
  • 50
  • Hi Mano.....I was thinking on the lines of the last point you have mentioned...."path to the web.config could be a setting in your App.exe.config"... I came across this that can be included in the App.exe.config file- Is this what you were referring to? If yes, is there anything more I need to add? – johnGirlCodes Mar 29 '16 at 06:47
0

You need to specify config file directory in your executable code. Take a look at that link.

Community
  • 1
  • 1
Orkun Bekar
  • 1,447
  • 1
  • 15
  • 36