Question

I am trying to find all assemblies in the current AppDomain, which are not part of the .NET framework (which means that they are either my own libraries or 3rd party libraries).

Is there any easier way to do it than hard-coding all the .NET Framework's assemblies names to my code and finding all Assemblies from AppDomain.CurrentDomain.GetAssemblies() which doesn't match any of them?

Was it helpful?

Solution

        Assembly a = Assembly.GetAssembly(typeof(Task));
        CustomAttributeData attributeData = a.CustomAttributes.First(attribute => attribute.AttributeType == typeof(AssemblyProductAttribute));
        string value = attributeData.ConstructorArguments[0].Value as string;

And the value will be Microsoft® .NET Framework

OTHER TIPS

String[] dotNetPaths=new string[]{"/Windows/Microsoft.Net/assembly/","/Windows/Microsoft.NET/Framework/"};
var otherAssemblies=AppDomain.CurrentDomain
                             .GetAssemblies()
                             .Where(x=>!dotNetPaths.Any(y=>x.CodeBase.Contains(y)));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top