While reading through my archive of RSS feeds from other blogs, I bumped into this one from Suzanne Cook.  After reading it, I thought...hmm, maybe I should write a function to do that for me ... so here it is, a C# version of an assembly verifier:

private const int COR_E_ASSEMBLYEXPECTED = -2147024885;
private bool IsAssembly(string asmFile)
{
    bool isAsmbly = true;
    try
    {
         AssemblyName.GetAssemblyName(asmFile);
    }
    catch(BadImageFormatException imageEx)
    {
         int hrResult = Marshal.GetHRForException(imageEx);
         isAsmbly = (hrResult != COR_E_ASSEMBLYEXPECTED);
    }

    return isAsmbly;
}


Currently, I'm working on a C++ version of this that does not require the .NET framework. But if you are loading an assembly dynamically from your application, you can use this to check it.