Clickonce update strategy change in .Net5

Elmar 26 Reputation points
2021-04-11T11:41:24.537+00:00

I have converted a Framework WPF application win-X64 to .net5. It successfully compiles and runs. Then I published it with Clickonce (install location: UNC path). But now, every time I start the app with a double-click on its start menu icon, a message box pops up, telling me that "The prerequisites for the application are being checked and that this can take some time".

86573-clickonce-prelaunchmsg.png

I suppose this means, it is checking for any available updates, because I chose that option in the publishing dialog. Besides, when I just double-click the exe file in the application folder, the application starts without delay. For Framework-Clickonce applications I usually choose "check for updates after application startup", where the check runs unobtrusively in a background thread. But it seems, this option is no longer available for .net5. At least "check after startup" was greyed out in the publishing dialog.

Is it normal for .net5 applications, published with Clickonce, that the application start is accompanied with that message box? Why can I no longer choose "Check after startup"?

Thank you in advance!

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,671 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,245 questions
0 comments No comments
{count} votes

Accepted answer
  1. Daniel Zhang-MSFT 9,611 Reputation points
    2021-04-12T08:59:51.383+00:00

    Hi Elmar-4711,
    I tested it in .net 5, and the "After the application starts" option is indeed not selectable.
    It indicates that this feature is not yet supported in .net 5, and this problem is also clearly pointed out in this thread.
    Best Regards,
    Daniel Zhang


    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 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Elmar 26 Reputation points
    2021-04-12T17:31:42.167+00:00

    @Jci , thank you for the SO-reference that shows, that there are indeed still differences between .Net and .Net Framework when it comes to publishing with ClickOnce. I'm still struggling with some of them.

    But I finally realized that I myself bore the blame for the annoying messages I mentioned above. I made all calls to asynchronous methods in my application ConfigureAwait(false) and missed completely that one of them was directly linked to the UI creation.

    MainWindowViewModel viewModel = await MainWindowViewModel.CreateAsync().**ConfigureAwait(false)**;  
    

    So, every time I started the application ConfigureAwait threw an InvalidOperationException and gave the updates checking process the time to display this message. A moment later the application started anyway and I didn't notice the exception and blamed ClickOnce and .NET 5 instead for this annoyance.

    Now, after removing the malicious code, everything works fine. Don't set ConfigureAwait on anything linked to the UI.

    0 comments No comments