Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting file version info in the Compact Framework

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.

I can't get this to work:

Assembly assembly = Assembly.LoadFrom("\\Program Files\\Microsoft SQL Server Compact Edition\\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"); 

creates an object where fileInfo.Exists == true.

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

like image 204
ger Avatar asked Aug 28 '26 03:08

ger


1 Answers

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.

EDIT

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.

like image 126
ctacke Avatar answered Aug 30 '26 19:08

ctacke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!