question

KyeongdonLim-5270 avatar image
0 Votes"
KyeongdonLim-5270 asked ·

Clickonce update problem

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.


dotnet-csharpwindows-wpf
update-ui.png (59.1 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DaisyTian-MSFT avatar image
0 Votes"
DaisyTian-MSFT answered ·

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.

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for your reply!

Uncheck all of update option from .csproj mean like this!

50414-updateoption.png

I did it for show custom clickonce update ui.


Ps. Sorry for my bad english.


0 Votes 0 ·
updateoption.png (30.4 KiB)