473,322 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Programatically getting my AssemblyVersion

How does one get the AssemblyVersion of the currently excuting
assembly? At first glance, it would appear that this would give you
the AsseblyName which will give you the version:

string appName =
AppDomain.CurrentDomain.SetupInformation.Applicati onName;
AssemblyName assemblyName = AssemblyName.GetAssemblyName(appName);

But the appname is <name>.vshost.exe. Is there any way to find out the
name of the assembly minus the vshost?

Feb 21 '06 #1
3 38188
The answer:

string appName = Assembly.GetAssembly(this.GetType()).Location;
AssemblyName assemblyName = AssemblyName.GetAssemblyName(appName);
return assemblyName.Version.ToString();

Feb 21 '06 #2
>string appName = Assembly.GetAssembly(this.GetType()).Location;
AssemblyName assemblyName = AssemblyName.GetAssemblyName(appName);
return assemblyName.Version.ToString();


Or just

return this.GetType().Assembly.GetName().Version.ToString ();
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Feb 21 '06 #3
Hi,

"herc" <ca******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
The answer:

string appName = Assembly.GetAssembly(this.GetType()).Location;
AssemblyName assemblyName = AssemblyName.GetAssemblyName(appName);
return assemblyName.Version.ToString();


A shorter way:

Assembly.GetExecutingAssembly().GetName.Version.To String()

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 21 '06 #4

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

Similar topics

3
by: Tym | last post by:
OK - daft question of the day time... If I have database A which contains all the live data, and Database B which contains linked tables to those is A (i.e. a front end) is there a way of seeing...
2
by: Dave Bootsma | last post by:
Is it possible to programatically save a certain image from a certain web page? I want to automatically get a specific graphic from a specific web page programatically so I can automate the...
2
by: nfr | last post by:
I keep getting the following warning in my compile: Warning: The dependency 'WBWebServices, Version=1.0.1289.13943, Culture=neutral' in project 'WBWin' cannot be copied to the run directory...
0
by: Mark | last post by:
In the AssemblyInfo.cs page of a ASP.NET project, there is a defaulted property of: It's my understanding that this indicates a Major Version of 1, a Minor Version of 0, and a Build and...
2
by: Mark | last post by:
In the AssemblyInfo.cs page of a ASP.NET project, there is a defaulted property of: It's my understanding that this indicates a Major Version of 1, a Minor Version of 0, and a Build and...
4
by: Matthew Smith | last post by:
Is there a way to get the value that is stored in the AssemblyVersion attribute that's in AssemblyInfo.cs?
1
by: | last post by:
In C#, when one specifies an assembly attribute for the Assembly version, this becomes the file version as well. In Managed C++, there appears to be no relation between the assembly attribute and...
4
by: One Handed Man | last post by:
Ive been working on this since yesterday and its bugging me. Although the event is firing, The box does not scroll. Can anyone see what Im doing wrong. I suspect it is stupidly simple. TIA
7
by: Michael Maes | last post by:
Hi, Setting the Assembly Version is no problem (<Assembly: AssemblyVersion("1.1.20043.13")>) but how do I set the FileVersion (of the dll)? TIA, Michael
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.