acess dll from various locations


Well-known member
Nov 13, 2012
Programming Experience
I have a C# 2008/2010 application that is currently accessed as a exe file and I would like to change the application so that the exe is accessed though as a reference. The code that calls the dll is a process and the code looks like the following:

strConsoleAppLocation = ConfigurationManager.AppSettings["dll_location"];
string Process_Arguments = null;
Process RPT_Process = new Process();
RPT_Process.StartInfo.FileName = strConsoleAppLocation;
Process_Arguments = " 7 " + strCUSTID + " 1";
RPT_Process.StartInfo.Arguments = Process_Arguments;

The problem is the dll is currently placed in various locations like unit test area, client acceptance testing, system testing, and then into production by the 5 applications that call it. The application currently obtains the various locations based upon values in the app.config file. If I add this dll has a reference to the programs that call it, how will I tell those calling programs where to obtain the 'correct' directory location? Would I use the app.config file?
Can you show me code and/or explain to me how to solve this issue?
Last edited:


C# Forum Moderator
Staff member
Apr 23, 2011
Sydney, Australia
Programming Experience
If you're referencing the DLL in an application project then there are only really two reasonable locations for that DLL:

1. The same folder as the application EXE.
2. The Global Assembly Cache (GAC).

If you choose the GAC then multiple applications all use the one copy of the DLL while option 1 requires a separate copy of the DLL for each application. In either case, you don;t have to tell the application where to find it. It already knows to look in those two locations.
Top Bottom