Retrieving Product Versions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.

I need to retrieve the product version of a specific file from within my
VB.Net application so that I can determine if the application has the correct
version from a third party supplier.

I have done it in other languages just not .Net so I know it is possible.
But don't know how to do it in VB.Net.

Thanks In Advance,
Chris Braun
 
Chris,

There are more possibilities two of them

\\\
MessageBox.Show( _
System.Reflection.Assembly.GetExecutingAssembly( _
).GetName().Version.ToString())
'or
MessageBox.Show( _
System.Windows.Forms.Application.ProductVersion)
///

I hope this helps?

Cor
 
Cor

It appears that these both methods require the 'file' in question to be part
of the application. I guess I should have been more specific. What I really
need to find out is what version of MS SQL Server the user is currently?.

I tried using the windows reqistry BUT if the user installed MSDE their
version number is 8.00.194 even after they have installed service pack 3
(8.00.760) so I can't use the Windows Registry.

Thanks in Advance,
Chris Braun
 
Is this what you are needing?

Dim exefile As String = "C:\Program Files\Microsoft Office\Office\Winword.exe"
Dim fvi As FileVersionInfo = FileVersionInfo.GetVersionInfo(exefile)

Console.WriteLine("ProductName: {0}", fvi.ProductName)
Console.WriteLine("ProductVersion: {0}", fvi.ProductVersion)
Console.WriteLine("CompanyName: {0}", fvi.CompanyName)
Console.WriteLine("FileVersion: {0}", fvi.FileVersion)
Console.WriteLine("FileDescription: {0}", fvi.FileDescription)
Console.WriteLine("OriginalFilename: {0}", fvi.OriginalFilename)
Console.WriteLine("LegalCopyright: {0}", fvi.LegalCopyright)
Console.WriteLine("LegalTrademarks: {0}", fvi.LegalTrademarks)
Console.WriteLine("Comments: {0}", fvi.Comments)
Console.WriteLine("InternalName: {0}", fvi.InternalName)

Just replace WinWord.exe with the file you need the information on.
 
Chris,

Because the SQL server should not be reachable as file, your solution will
in my opinion fail forever.
I don't know the answer for you, however to get the answer it is more simple
when you ask it yourself in this newsgroup.

Adonet
news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet

Web interface:
http://communities2.microsoft.com/c.../?dg=microsoft.public.dotnet.framework.adonet


When they don't know it there it will be hard to find.

(You can try it as well crossposted to the newsgroup General, about this
does by instance Nick Malick often know a lot and he is active as well in
most, however mostly in General).

Cor
 
Chris,
In addition to the other comments:

To find out specifically the version of SQL Server you are using, consider
using "SELECT @@VERSION".

I do not have the link handy on what version numbers represent which service
packs...

You can use a SqlCommand to execute the above, something like:

Dim connection As New SqlClient.SqlConnection("integrated
security=SSPI;data source=.;")
connection.Open()
Try
Dim command As New SqlClient.SqlCommand("Select @@version",
connection)
Dim version As String = DirectCast(command.ExecuteScalar(),
String)
Debug.WriteLine(version, "SQL Version")
Finally
connection.Close()
End Try

Alternatively you could use the xp_msver extended store procedure to return
specific values (rather then attempt to parse the string returned from
@@version). See the BOL for information on xp_msver.

Hope this helps
Jay
 
Crouchie1998

Thanks this is what I was looking for.

Thanks,
Chris Braun
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top