After some googling, I learn that the cause of the problem comes from this code:
lblVersion.text = Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString
Reference: How to show program version in your form?It is said that the code only works when deployed the application via ClickOnce.
Well, I am publishing my work via ClickOnce but I test my application via "debug" or "release" folder.
For a while, Just to avoid the error, I changed my code to this:
lblVersion.text = My.Application.Info.Version.ToStringBut the version displayed is not the Published version. but the assembly version. Well, at least I got rid of the error. I will change it back when I want to publish it and deploy it via ClickOnce later.
ps: If only I can do Conditional Compiling with "#If Publish via ClickOnce". Is that possible?
No comments:
Post a Comment