问题
I understand that ClickOnce applications can update automatically. However, the options offered by Microsoft are not what I am looking for.
If I check the version before the application starts, the startup is slower.
If I chek the version after the application starts, I don't know than a new version is available until the next startup.
I am looking for a boolean function to check if a new version is available. This would enable me to suggest to the user to restart the application.
回答1:
using System.Deployment.Application;
public bool IsUpdateAvailable()
{
if (!ApplicationDeployment.IsNetworkDeployed) return false;
return ApplicationDeployment.CurrentDeployment.CheckForUpdate();
}
Of course, you might want to make this feature accessible via a button and wrap some UI around it, like this.
来源:https://stackoverflow.com/questions/1507209/is-there-a-way-to-check-if-a-clickonce-application-is-running-the-latest-version