473,785 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting a file version

How can I read the version of an existing file?
The file I checking is a COM dll file.
-------
Thanks
Sharon
Mar 31 '08 #1
4 1607
On Mar 31, 10:42*am, Sharon <Shar...@newsgr oups.nospamwrot e:
How can I read the version of an existing file?
The file I checking is a COM dll file.

-------
Thanks
Sharon
Hi,

what you mean with the version?
Mar 31 '08 #2
Try:

System.Diagnost ics.FileVersion Info.GetVersion Info("foo.dll") ...

etc

Marc
Mar 31 '08 #3
Well, the FileVersionInfo .Version is a string, and can actually be pretty
much anything - however, if you are happy that it will generally be a
standard version, then you could try using Version ver = new
Version(fvi.Ver sion) [if you see what I mean]; Version offers all the
comparisons you should need. However, be sure to catch the exception when
FileVersionInfo .Version is "fred"...

Marc
Apr 1 '08 #4
Great, thanks.
Even for files like "C:\WINDOWS\sys tem32\comctl32. dll" it is working when
using instead of the FileVersion the following:

string path = @"C:\WINDOWS\sy stem32\comctl32 .dll";
FileVersionInfo fvi = FileVersionInfo .GetVersionInfo (path);
Version version = new Version(fvi.Fil eMajorPart, fvi.FileMinorPa rt,
fvi.FileBuildPa rt, fvi.FilePrivate Part);

--
Thanks
Sharon
Apr 2 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1400
by: Navanee | last post by:
Hi, I am have a xml file with the following structure. (emp.xml) <?xml version="1.0" ?> <employee> <name>Navanee</name> <age>24</age> <sex>Male</sex> <city>Madurai</city> <new>Test New </new>
2
56956
by: kris | last post by:
Hello, We're porting some old code to our new C# .NET project and are having trouble getting the file version of a non-.NET EXE file using C# .NET code. In our old code, we were using the FileSystemObject (specifically the GetFileVersion method) to easily get the version of the EXE file. In .NET however, we haven't been able to figure out an equivalent method to easily get the file version of a non-.NET file.
2
2010
by: William Gower | last post by:
I am trying to display a page that has a data grid on it. I get this message Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: Access is denied: 'DataAccessLayer'. Source Error:
2
1650
by: JIM.H. | last post by:
Hello, I know the user I give in the connection string is the database admin, why am I getting the following message? Server Error in '/' Application -------------------------------------------------------------------------------- Access is denied. Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the
2
5291
by: Praveen | last post by:
Hi All, I have made a webservice in C# and it works fine in my machine. I ran into a crazy problem when I wanted to deploy it in windows 2003 server. I have run "aspnet_regiis.exe -i" to make sure that the extensions for .asmx file etc are in place. I am getting http 404 when I give the url for the asmx file. the http error code is wrong because I am dead sure that the file is there. could you please let me know what else needs to be...
8
6307
by: lawrence k | last post by:
I've installed Apache 1.3.36 on my Redhat EL 3 machine. Now I'm trying to install PHP 5.1.4. I can not get the ./configure command to work. I keep getting this error: configure: error: Invalid Apache directory - unable to find httpd.h under /usr/local/apache/include So then I run this command: find / -name httpd.h
1
1879
by: Jerry John | last post by:
I am working in ASP.NET with C#. I have a text file which contains datas with delimiters. For example:- MSH|^~\$|DISCHARGE|CLAY COUNTY MEMORIAL|||200502110939| I also have an XML file created with predefined tags. Some of the tags contain child element. I need to pass the data from the text file i.e the value within the delimiters should be passed to the corresponding tags within the XML file. I have done this through hard code. But i...
0
1095
by: UJ | last post by:
I have a web site that works fine on my development machine. When I publish it to our production server and try to run a Crystal Report I get the following error message: Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error
6
2811
by: WT | last post by:
Hello, Using VS2005. I have an assembly library that can be called from a Web site asp.net application or from a winform application. From this library I need to retrieve a path using simply a key like 'libPath'. As far as winform and asp.net share the same common base class for settings, SettingsBase, how to manage this ? For winform the value should be set in app.config and for web site in
185
7135
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will return the file name given a FILE *. Questions: What would be the best name for this function?
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10346
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.