Created
December 14, 2015 22:18
-
-
Save JeremyMorgan/ce7f8b4dc928f8b28178 to your computer and use it in GitHub Desktop.
Get real location of assemblies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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