dotnet / deployment-tools

This repo contains the code to build the .NET deployment tools and installers for all supported platforms, as well as the sources to .NET deployment tools.
MIT License
169 stars 50 forks source link

ClickOnce stops searching for updates #101

Closed coder925 closed 3 years ago

coder925 commented 3 years ago

Description

I'm running dotnet mage to publish deployments, but the client is only updating one time. (UpdateOnce :relaxed:)

I'm expecting the client to always update to the latest required version if there is a newer version available. This is regardless how often new updates are released.

Steps to reproduce:

Prerequisites:

  • An empty shared folder with read and write access. (e.g. \\comdev1\clickonce )
  1. Create a file deploy-first.bat in c:\temp with content:
    
    set coVersion=1.0.0.0
    set appName=TestApp1
    set sharedFolder=\\comdev1\clickonce
    set providerUrl=%sharedFolder%\%appName%.application

dotnet mage -cc mkdir c:\temp\%appName% cd c:\temp\%appName% dotnet new wpf -f net5.0 dotnet publish -o publish/%coVersion%/ cd publish dotnet mage -al %appName%.exe -td %coVersion% dotnet mage -new Application -t %coVersion%\%appName%.manifest -fd %coVersion% -v %coVersion% dotnet mage -new Deployment -i true -pub "Test Publisher" -v %coVersion% -appm %coVersion%\%appName%.manifest -t %appName%.application -pu %providerUrl% xcopy . %sharedFolder% /S /Y start %providerUrl%

2. Create a file _deploy-next.bat_ in c:\temp with content:

set coVersion=1.0.0.1 set appName=TestApp1 set sharedFolder=\comdev1\clickonce set providerUrl=%sharedFolder%\%appName%.application

cd c:\temp\%appName% dotnet publish -o publish/%coVersion%/ cd publish dotnet mage -al %appName%.exe -td %coVersion% dotnet mage -new Application -t %coVersion%\%appName%.manifest -fd %coVersion% -v %coVersion% dotnet mage -new Deployment -mv %coVersion% -v %coVersion% -pub "Test Publisher" -appm %coVersion%\%appName%.manifest -t %appName%.application -pu %providerUrl% xcopy . %sharedFolder% /S /Y



3. Run the script _deploy-first.bat_.
    The script creates a new .NET Core WPF app and publish it. Finally it installs the app on your client.
    Close the started app.

4. Modify the WPF app. E.g. change Title in MainWindow.xaml to _MainWindow 1.0.0.1_.

5. Run the script _deploy-next.bat_.
   The script publishes the changed WPF app.

6. Start the app from the start menu. The new version 1.0.0.1 is launched.
    Close the app.

7. Modify the WPF app again. E.g. change Title in MainWindow.xaml to _MainWindow 1.0.0.2_.

8. Edit script _deploy-next.bat_. Change first line to `set coVersion=1.0.0.2` .

9. Run the script _deploy-next.bat_.

10. Start the app from the start menu.

**Expected result:** WPF app is updated and shows title 1.0.0.2.
**Actual result:** WPF app is no longer updated. Title is still 1.0.0.1

### Configuration

* Which version of .NET is the code running on? **5.0.103**
* What OS and version, and what distro if applicable? **Microsoft Windows [Version 10.0.19042.804]**
* What is the architecture (x64, x86, ARM, ARM64)? **x64**
* Do you know whether it is specific to that configuration? **Don't know**

### Regression?

* Did this work in a previous build or release of .NET Core, or from .NET Framework? If you can try a previous release or build to find out, that can help us narrow down the problem. If you don't know, that's OK. **Don't know**

### Other information

* Do you know of any workarounds?
If I run `\\comdev1\clickonce\TestApp1.application`, the application updates to the latest version sucessfully.  
NikolaMilosavljevic commented 3 years ago

[Triage] Please investigate.

coder925 commented 3 years ago

@NikolaMilosavljevic , thank you for looking into this. Were you able to reproduce the issue? Please let me know in the case I'm doing something wrong or if there is any other workarounds. For now, I'm deploying my app with -Install false. However, I'd like to switch to an installed app as soon as I can get the updates to work. Thanks!

NikolaMilosavljevic commented 3 years ago

@coder925 apologies for the delay - I will try to repro this today.

NikolaMilosavljevic commented 3 years ago

@coder925 I was able to reproduce this issue.

However, if I modify your deploy-next.bat script to replace -mv %coVersion with -i true you will get the correct update experience, for all app updates.

I will debug why -mv option does not produce the expected outcome.

coder925 commented 3 years ago

@NikolaMilosavljevic , good that you were able to reproduce it and thanks for the found workaround!

In my specific case unfortunately, I cannot skip the -mv option. Whenever there is an update available, my clients must update in order to be allowed to run the app. Hopefully it can be fixed.

coder925 commented 3 years ago

@NikolaMilosavljevic , did you find the bug? If so, when do you believe a fix can be released?

NikolaMilosavljevic commented 3 years ago

@NikolaMilosavljevic , did you find the bug? If so, when do you believe a fix can be released?

@coder925 it seems that old .NET FX tool 'Mage' generates the exact same ClickOnce manifest. I expect the issue to exist there as well. Is this a regression from .NET FX?

coder925 commented 3 years ago

@NikolaMilosavljevic , I have only tested with dotnet mage on .NET 5.0. I don't know about the other versions.

NikolaMilosavljevic commented 3 years ago

@NikolaMilosavljevic , I have only tested with dotnet mage on .NET 5.0. I don't know about the other versions.

It seems that this issue has always existed in Mage tool, even in old .NET FX.

It is blocking simultaneous usage of -i and -mv, so it essentially allows specifying minimum version for online apps only, which seems incorrect. I think the tool should only block combination of -i false and -mv. I need to investigate this further.

Interestingly, this issue does not exist if app is published from Visual Studio.

NikolaMilosavljevic commented 3 years ago

In PR: https://github.com/dotnet/deployment-tools/pull/119