get application version in windows application c#

I use this code for get application version

private string CurrentVersion
            return ApplicationDeployment.IsNetworkDeployed
                   ? ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString()
                   : Assembly.GetExecutingAssembly().GetName().Version.ToString();

But in debug mode and when I publish and install application I get How can I fix this problem?


In this line of code you are actually trying to obtain an assembly version.

return Assembly.GetExecutingAssembly().GetName().Version.ToString();

You need to set the assembly version in Properties -> Application -> Assembly Information.

Need Your Help

How to auto resize table column when double clicking on Cocoa?

objective-c cocoa macos nstableview nstablecolumn

I want to auto resize table column to its content width when double clicking its header (resize cursor is showing), like on iTunes.