Some of our apps have a dependency on a common dll that is used for logging and configuration. This common dll is added to the GAC on our servers, and isn't included in the bin folder of our deployments.
I want to write a simple console app to check if common.dll has been added to the GAC on the servers. I have had no luck checking this programatically using fusion or assembly.load: Check GAC for an assembly
My idea was to include a reference to the dll locally, make sure copy local is off and then try catch the FileNotFoundException on the server when a call is made to a method in the dll.
Something like this
static void Main()
{
try
{
Common.Logger.LogInfo("Testing logger."); //call to the dll
Console.WriteLine("loaded successfully");
Console.ReadLine();
}
catch (System.IO.FileNotFoundException e)
{
Console.WriteLine("Common dll missing!" + e.Message);
Console.ReadLine();
}
}
But as the dll isn't present the app will crash and throw a FileNotFoundException before even hitting the main method. I assume there is some initial checking that all dlls are present when running the .exe - is there a way to disable this?