Setting Assembly Version to 1.0.*

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
I havent found a way to do this in the designer in either VB or C# - it just complains "A wildcard is not allowed in this field"

But if I edit the AssemblyInfo then, as per the comments, I can say that mky program is 1.0.*



Where my C# and VB now differ is that when I build and start my app in C# - the * in the version is replaced by the build and revision so i get 1.0.231.29856 or something

In VB, it just comes through as 1.0.* whenever I query the Application.ProductVersion text


Does someone know what I've missed in VB that makes it not sub in the version numbers?
 
The Assembly Information dialog doesn't allow wildcard I noticed too, but you can edit this directly in file AssemblyInfo.vb, find it with Solution Explorer (show all files), expand My Project and there it is. Doubleclick the file and its contents will reveal, the second to last line usually specifies the AssemblyVersion, where "you can accept the default build number, revision number, or both by using an asterisk (*)." If you do this and go back to the Assembly Information dialog it now displays the character it wouldn't first accept. Build and see the files assembly version information go default.
 
I just found out that the Assembly Information dialog do accept wildcard, but only the last field. You can set revision to *, or you can leave revision empty to allow * in build field.

About Application.ProductVersion, it returns the file version, not the assembly version. I didn't see this first because I checked the attributes of the exe file. Also
when not debugging System.Diagnostics.Process.GetCurrentProcess.MainModule.FileVersionInfo.ProductVersion will return the same.

My.Application.Info.Version will give you the assembly version in code (or System.Reflection.Assembly.GetExecutingAssembly.GetName.Version.ToString)
 
Brilliant.. thanks JohnH


For others wishing to follow this route and have, for example, a Title bar text that says the version, go to Properties of your project. First tab, application.. Put the version in Assembly Version as:
Assembly Version: [ 1] [ 0] [ *] [ ] <-text fields


Then in your form:
Me.Title = "MyApp v" & My.Application.Info.Version


before, I was using Application.Productversion which in this case, didnt have the info i wanted..
 
Back
Top