You can use an Assembly Resolver class/event to load the DLLs from the EG install as needed.
Add a class like this:
/// <summary>
/// Class to help you use SAS Enterprise Guide classes from their installed location
/// </summary>
public class SEG71AssemblyResolver
{
#region internal members
internal static string PathToEGuideInstall = @"C:\Program Files\SAS\EnterpriseGuide\7.1";
#endregion
/// <summary>
/// Install the AssemblyResolver event listener and discover locations of installed assemblies
/// </summary>
public static void Install(string path)
{
PathToEGuideInstall = path;
// install Assembly Resolver event
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(currentDomain_AssemblyResolve);
}
/// <summary>
/// Resolve assemblies not found in the current directory
/// </summary>
/// <param name="sender">Sender of event</param>
/// <param name="args">contains a Name property with the assembly name needed</param>
/// <returns>Loaded assembly, loaded by this routine</returns>
private static Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
string[] name = args.Name.Split(',');
string path = System.IO.Path.Combine(PathToEGuideInstall, name[0] + ".dll");
try
{
Assembly foundAssembly = Assembly.LoadFile(path);
return foundAssembly;
}
catch (System.IO.FileNotFoundException)
{
return null;
}
}
}
Then "install" this handler in the Main() function for your app:
SAS.EG.Automation.SEG71AssemblyResolver.Install(EGinstall);
Passing in the path where EG is installed on your system. This class *should* direct the .NET runtime to load any assembly it needs from the installed app folder.
... View more