ClickOnce-是否自动进行所有构建? [英] ClickOnce - automatically making all builds required?

查看:60
本文介绍了ClickOnce-是否自动进行所有构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在一个脚本,用于始终使我所有已发布的版本都需要更新?我想无论如何都强制对所有客户进行更新,但是,即使使用了ClickOnce部署API,也会询问他们是否要更新。

Is there a script for always making all my published builds required, update-wise? I want to force an update to all my customers no matter what, however, they are asked whether or not they want to update, even after using the ClickOnce deployment API.

推荐答案

我最终使用了ClickOnce部署API,在那里我可以更好地控制该过程。技巧是将应用程序设置为100%脱机运行的CD-ROM应用程序。然后,使用简单的ClickOnce代码,可以执行无提示更新。

I ended up using the ClickOnce deployment API, where I have much more control over the process. The trick is to set the application as a CD-ROM application that runs 100% offline. Then, using simple ClickOnce code, a silent update can be performed.

    private void Update()
    {

        try
        {

            ApplicationDeployment.CurrentDeployment.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(CurrentDeployment_CheckForUpdateCompleted);
            ApplicationDeployment.CurrentDeployment.UpdateCompleted += new System.ComponentModel.AsyncCompletedEventHandler(CurrentDeployment_UpdateCompleted);

            ApplicationDeployment.CurrentDeployment.CheckForUpdateAsync();

        }
        catch (Exception)
        {
        }

    }

    void CurrentDeployment_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
    {
        try
        {
            if (e.UpdateAvailable)
            {
                ApplicationDeployment.CurrentDeployment.UpdateAsync();
            }
        }
        catch (InvalidOperationException)
        {
        }
    }

    void CurrentDeployment_UpdateCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
    {
        //TODO: update completion code here
    }

这篇关于ClickOnce-是否自动进行所有构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆