Background
First of all, I did look elsewhere for a solution and found this solution, but this does not solve my issue.
I have an assembly referenced in my main project in Visual Studio, but I need to load it from outside my project, not in a sub-folder. I can load the assembly with the call...
System.Reflection.Assembly.LoadFrom(myExternalAssemblyPath);
...but the program will not run and gives me the following error:
FileNotFoundException was unhandled
Could not load file or assembly 'MyAssembly, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I have no calls to the assembly before the call to load it, but the program still expects, even before it even enters the Main
function apparently, that the DLL be in the program's folder.
Quesiton:
How do I get my program to still reference this in Visual Studio, but load it from a different location when actually running the program? Is there a directive I need to specify somewhere to tell the program to wait to load it? Is there some other solution?
NOTE: I do not want to add the folder and DLL to the PATH variable. That is not a viable solution.