-2

Hi guys a project I'm working on has an app config file which determines what other dll's to load at runtime. I have been tasked with adding the functionality of taking the dll from our servers and then changing the app conifg to have the exe now load up with that file. The idea is the user at runtime will choose a file and then the app config will change and then restart the exe with the new dll loaded.

I couldnt seem to find exactly what I was looking for. We are using Visual Studio 2012 with .net 4.

How do you edit the app config file at runtime and then have the program close and rerun?

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
Garrett Minky
  • 27
  • 1
  • 10
  • Have you considered delay loading the DLL instead using [Assembly.Load()](http://msdn.microsoft.com/en-us/library/25y1ya39(v=vs.110).aspx)? You could then invoke the new instance of your EXE with the path to the DLL you want to load. – Jason Z Aug 05 '14 at 16:30
  • What is the motivation for this? Is this some sort of plug in architecture? MEF might help. – MatthewMartin Aug 05 '14 at 16:57

1 Answers1

1

This might help with adding an exe file to your app.config file: http://msdn.microsoft.com/en-us/library/ms184658.aspx OR Add an EXE file to a project, so that it will be copied to the Bin/Debug folder just like a DLL?

As for closing and reopening the file: How do I restart my C# WinForm Application?

Should help in pointing you in the right direction anyway.

Community
  • 1
  • 1
jbutler483
  • 24,074
  • 9
  • 92
  • 145