0

That may seem a bit obvious, but here's the situation: I have a Java program (Mirth Connect) which is processing medical record information, and one of the things I have it doing is invoking a .NET program (to do some things requiring Windows authentication that I had problems doing in Java/Javascript). The .NET program pulls settings from a settings file located in the directory it's invoked from; that is, from the directory where the Mirth Connect executable exists). I want to pull the settings from the directory where the .NET executable is, but short of hard-coding, I'm not sure how to find that directory.

Matt Gutting
  • 284
  • 3
  • 10

2 Answers2

0

To get the directory your EXE file is use:

 AppDomain.CurrentDomain.BaseDirectory

To get the current directory

 Evnironment.CurrentDirectory
AnthonyBCodes
  • 342
  • 2
  • 13
0

In a .NET application, there is no fixed place where the configuration file should be. It could be anywhere. You should check it for the specific program. I would first check if the configuration file of the .NET program you call is on the same directory with the executable. This is not a guaranteed but it is the default scenario. If it is not there, you should find out where it is and then use that relative path in all of your installations.

Hope I am not missing something!

Pantelis Natsiavas
  • 5,293
  • 5
  • 21
  • 36
  • I wasn't looking for where I ought to look for the config file; I'm the one placing the config file. I wanted to know how the .NET program can find the directory it's in. The thread above answers my question. – Matt Gutting Jan 13 '14 at 13:50