在Compact Framework中获取文件版本信息 [英] Getting file version info in the Compact Framework

查看:191
本文介绍了在Compact Framework中获取文件版本信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要能够找到程序集的版本号,给一个字符串表示它位​​于哪里一些code。

I have some code that needs to be able to find the version number of an assembly, given a string saying where it's located.

我不能得到这个工作:

Assembly assembly = Assembly.LoadFrom("\\Program Files\\Microsoft SQL Server Compact Edition\\v3.5\\sqlcecompact35.dll");

抛出一个System.IO.IOException:文件或程序集名称'\程序Files \ Microsoft SQL Server精简版\ V3.5 \ sqlcecompact35.dll,或之一依赖,找不到

throws a System.IO.IOException: File or assembly name '\Program Files\Microsoft SQL Server Compact Edition\v3.5\sqlcecompact35.dll', or one of its dependencies, was not found.

然而,该文件确实存在:

Yet the file does exist:

FileInfo fileInfo = new FileInfo("\\Program Files\\Microsoft SQL Server Compact Edition\\v3.5\\sqlcecompact35.dll"); 

创建一个对象,其中fileInfo.Exists ==真。

creates an object where fileInfo.Exists == true.

我应该是传递一个不同的文件名/路径加载SQL CE组件?谢谢你。

Should I be passing in a different filename/path to load the SQL CE assembly? Thanks.

推荐答案

sqlcecompact35.dll IS的没有的托管程序集,因此无法通过反射加载。该DLL,连同其他文件如sqlceqp35.dll,sqlceca35.dll(看在分布中的所有文件)是NATIE条数据引擎。你可能加载这种方式唯一的托管程序是System.Data.SqlServerCe.dll。

sqlcecompact35.dll is not a managed assembly and therefore cannot be loaded via Reflection. That DLL, along with other files like sqlceqp35.dll, sqlceca35.dll (look in the distribution for all files) are the natie pieces of the data engine. The only managed assembly that you might load this way is System.Data.SqlServerCe.dll.

修改

对于获取本机文件的文件版本信息不靠近容易在紧凑型框架。我已经建立和博客解决检索你这个信息。

Getting the file version info for a native file is not near as easy in the Compact Framework. I've built and blogged a solution to retrieve this info for you.

这篇关于在Compact Framework中获取文件版本信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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