Monday, May 16, 2016

Problem with "Application identity is not set". (solved?)

Today I got a problem when I test my application. I commonly build my application then run it from the "debug" or "release" folder in my VirtualBox.

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.ToString
But 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