Clickonce update problem

Kyeongdon Lim 41 Reputation points
2020-12-21T07:28:57.473+00:00

I'm not good at clickonce so I need help to solve my problem.

I made a application, and I trying to deploy my app via clickonce.

But, I do not want to auto update by clickonce.(this clickonce from .net framework folder)

So I uncheck all of update option from .csproj for application and I get a programmatically update source from msdn docs.

this is my update source. It using clickonce api.

public void UpdateStart()  
{  
	if (this.deployInfo == null)  
	{  
		return;  
	}  
  
	this.deployInfo = ApplicationDeployment.CurrentDeployment;  
	UpdateCheckInfo info = null;  
	bool updateAvailable = false;  
	try  
	{  
		info = this.deployInfo.CheckForDetailedUpdate();  
		updateAvailable = info.UpdateAvailable;  
	}  
	catch (Exception ex)  
	{  
		return;  
	}  
  
	if (!updateAvailable)  
		return;  
  
	this.deployInfo.UpdateProgressChanged += (s, e) =>  
	{  
		UpdateProgressState(e.State);  
		this.UpdatePercent = e.ProgressPercentage;  
	};  
	  
	this.deployInfo.UpdateCompleted += (s, e) =>  
	{  
		logger.I("Update process finish.");  
  
		string restartPath = GetClickonceRestartPath();  
		if (e.Cancelled)  
		{  
			restartPath = null;  
		}  
  
		if (e.Error != null)  
		{  
			restartPath = null;  
		}  
		RaiseCallback(restartPath);  
	};  
	this.deployInfo.UpdateAsync();  
}  

This code works well. It never call Clickonce's own update ui.
But if I call UpdateCancelAsync() from ApplicationDeployment class, It makes problem.

After call UpdateCancelAsync() and restart my application with .appref-ms file,
ClickOnce's update ui is popuped, even I never check any update options.

49924-update-ui.png

What should I do for hide that ClickOnce's ui?
Did I miss something?

Please let me know how to hide it.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,772 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,917 questions
0 comments No comments
{count} votes

Accepted answer
  1. DaisyTian-1203 11,621 Reputation points
    2020-12-22T09:40:10.107+00:00

    When use CheckForDetailedUpdate(false) , the update will be applied silently and no dialog box will be displayed.
    Please change your info = this.deployInfo.CheckForDetailedUpdate(); to info = this.deployInfo.CheckForDetailedUpdate(false); to hide the update UI.

    By the way, If I misunderstand your question, please point out and give me more details about your uncheck all of update option from .csproj for application?


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.