Version number in AboutBox1.cs

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am a very new programmer....
I have an About Box that I generated using a Windows Forms Template. Our build system for the product updates the AssemblyFile Version attribute in the GlobalAssemblyInfo.cs file. I have been to many sites and have found the code to properly
update the Details in the .exe Properties file to correctly display the product version, however, I have been unsuccessful at getting the version in the about box to display the same (and correct) version that the properties window is displaying.
My about box code is:
partial class AboutBox1 : Form<br/>
{<br/>
public AboutBox1()<br/>
{<br/>
InitializeComponent();<br/>
this.Text = String.Format("About {0}", AssemblyTitle);<br/>
this.labelProductName.Text = AssemblyProduct;<br/>
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);<br/>
this.labelCopyright.Text = AssemblyCopyright;<br/>
this.labelCompanyName.Text = AssemblyCompany;<br/>
this.textBoxDescription.Text = AssemblyDescription;<br/>
}
public string AssemblyVersion<br/>
{<br/>
get<br/>
{<br/>
return Assembly.GetExecutingAssembly().GetName().Version.ToString();<br/>
}<br/>
}
<br/>
And my GlobalAssemblyInfo.cs file is:
using System.Reflection;<br/>
using System.Runtime.CompilerServices;<br/>
using System.Runtime.InteropServices;

// Global settings<br/>
[assembly: AssemblyConfiguration("RELEASE")]<br/>
[assembly: AssemblyCompany("xxxx")]<br/>
[assembly: AssemblyProduct("xxxx")]<br/>
[assembly: AssemblyCopyright("xxxx.")]<br/>
[assembly: AssemblyTrademark("")]<br/>
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("2.0.*")]<br/>
[assembly: AssemblyFileVersion("2.0.*")]
<br/>
I have made sure that the AssemblyInfo.cs file does not contain any of the information that is in GlobalAssemblyInfo.cs.
I have tried changing the AboutBox1.cs file to have AssemblyFileVersion instead of AssemblyVersion but that didnt work.
What am I missing?


View the full article
 
Back
Top