How can I insert the assembly version number (which I set to auto increment) into a Winform form text?
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > Linker > General property page. Modify the Version property.
To change the name of your form, select it in the solution explorer and press F2. Then type in the new name for that form (don't forget the '.
Press "Ctrl" and drag your mouse to duplicate a existing form class file. Then exlude the existing form class file from the project.
WinForms won't be deprecated until Win32 is ... which could be quite sometime! WPF on the other hand has few direct dependencies on Win32 so could potentially form the basis of a "fresh start" UI layer on a future version of windows.
Either of these will work:
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; this.Text = String.Format("My Application Version {0}", version); string version = System.Windows.Forms.Application.ProductVersion; this.Text = String.Format("My Application Version {0}", version);
Assuming this is run on the Form
you wish to display the text on
Text = Application.ProductVersion
Quick way to get the full version as a string (e.g. "1.2.3.4")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With