如何确定DLL是COM或.NET? [英] How to determine if DLL is COM or .NET?

查看:189
本文介绍了如何确定DLL是COM或.NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个更新程序,从服务器拉文件有混合VB6的dll和.NET的DLL在一个目录。如何确定是否一个dll是一个COM一个? (这样我就可以在更新程序调用REGSVR32吧)

i have an updater program, the pulled files from server has mixed vb6 dll and .net dll in one directory. how to determine if a dll is a COM one? (so i can invoke regsvr32 to it from the updater program)

推荐答案

我想这样做是尝试装入System.Reflection.Assembly.LoadFile文件()的一种方式。如果你得到一个BadImageFormatException,这不是一个有效的.NET程序集。有可能是这样做的更合适的方法,但这应该工作。

I guess one way to do it would be to try load the file with System.Reflection.Assembly.LoadFile(). If you get a BadImageFormatException, it's not a valid .NET assembly. There's probably a neater way of doing this, but this should work.

<一个href="http://msdn.microsoft.com/en-us/library/b61s44e8.aspx">http://msdn.microsoft.com/en-us/library/b61s44e8.aspx

这篇关于如何确定DLL是COM或.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆