question

Elmar-4711 avatar image
0 Votes"
Elmar-4711 asked Elmar-4711 answered

Clickonce update strategy change in .Net5

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!

dotnet-csharpwindows-wpf
5 |1600 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.

DanielZhang-MSFT avatar image
1 Vote"
DanielZhang-MSFT answered

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.


5 |1600 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.

Elmar-4711 avatar image
0 Votes"
Elmar-4711 answered

@Daniel, 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.

5 |1600 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.