The past applications I've written were on .Net Framework, I've moved to .Net6 for my current project and some of the C# I had previously used on .Net Framework 4.x.x no longer works with the .Net6 WinForms app. I want to be able to pull the published version number of the application and have it as a string in code.
Previously on Framework I had used something like...
var ver = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion;
It looks like .Net6 doesnt have System.Deplyment
which I'm assuming is because it is built off of Core.
I've searched around but all of the solutions either don't pull the Published version, or are solutions that work on Framework and not on .Net6.
The current Published Version # is 0.0.1, This is set in the ClickOnce pusblish dialog. This is the number I need to access. I have tried the following...
string ver = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
Returns: 1.0.0
string ver = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
Returns: 1.0.0.0
string ver = GetType().Assembly.GetName().Version.ToString();
Returns: 1.0.0.0
System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();
Returns: 1.0.0.0
None of those seem to be pulling the version Number I'm looking for, I assume those are set somewhere else in the properties. Is there a way for me to access the Published application version number from inside Form.cs in a basic Windows Form app built on .Net6?