Skip to content

Instantly share code, notes, and snippets.

@JeremyMorgan
Created December 14, 2015 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeremyMorgan/ce7f8b4dc928f8b28178 to your computer and use it in GitHub Desktop.
Save JeremyMorgan/ce7f8b4dc928f8b28178 to your computer and use it in GitHub Desktop.
Get real location of assemblies
string[] assemblyLocations = GetAssemblyLocation(new string[] { "System.Web.dll", "System.dll", "EntityFramework.dll" });
private string[] GetAssemblyLocation(string[] assemblyNames)
{
string[] locations = new string[assemblyNames.Length];
for (int loop = 0; loop <= assemblyNames.Length - 1; loop++)
{
locations[loop] = AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic && a.ManifestModule.Name == assemblyNames[loop]).Select(a => a.Location).FirstOrDefault();
}
return locations;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment