判断一个DLL是不是程序集

class TestAssembly
{
    static void Main()
    {
        try
        {
            System.Reflection.AssemblyName testAssembly =
                System.Reflection.AssemblyName.GetAssemblyName(@"C:/WINDOWS/system/avicap.dll");

            System.Console.WriteLine("Yes, the file is an Assembly.");
        }

        catch (System.IO.FileNotFoundException e)
        {
            System.Console.WriteLine("The file cannot be found.");
        }

        catch (System.BadImageFormatException e)
        {
            System.Console.WriteLine("The file is not an Assembly.");
        }

        catch (System.IO.FileLoadException e)
        {
            System.Console.WriteLine("The Assembly has already been loaded.");
        }
    }
}

原文地址:https://www.cnblogs.com/tongdengquan/p/6090616.html