How do you know if the ClickOnce app has just been updated?

In my ClickOnce C # application, how can I find out if the user just updated the application? I would like to suggest showing release notes or a change log after the user has downloaded the update.

I know how I can programmatically (spell?) Detect if an update is available and manually update. Then I could show notes of changes or release, but I would like it to be possible after the update, if possible. My googlefu didn't help me.

+3
source share
2 answers

I'm not sure if the Framework mechanism exists or not for this.

. # , # (Registry/AppData/Anyatever), #. # , " ", .

, - :

private string version
{
    get
    {
        System.Reflection.Assembly _assemblyInfo = System.Reflection.Assembly.GetExecutingAssembly();

        string ourVersion = string.Empty;

        if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
        {

            ourVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
        }
        else
        {
            if (_assemblyInfo != null)
            {
                ourVersion = _assemblyInfo.GetName().Version.ToString();
            }
        }

        return ourVersion;
    }
}
+3

, CheckForUpdate():

using System.Deployment.Application;

public bool IsUpdateAvailable()
{
    if (!ApplicationDeployment.IsNetworkDeployed) return false;

    return ApplicationDeployment.CurrentDeployment.CheckForUpdate();         
}
0

Source: https://habr.com/ru/post/1728632/


All Articles