0

I have an sideloaded UWP application where I want to do automatic updates via a UNC path. My application is able to download the updates by itself into C:\Users\<username>\AppData\Roaming\somerandomfolder

However it seems, that the automatic update mechanism does not handle system variables:

  • When entering %appdata%\somerandomfolder, it says: "Path has to begin with https:// or \\"
  • When entering C:\%appdata%\somerandomfolder (which leads to the same path as above when entered in Explorer), VisualStudio accepts the path, however instead of using the correct path, it creates a folder %appdata% at C:\

Is there a way to enter an update path for sideload updates without knowing the exact username?

Thanks in advance

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
  • why not use `Environment.GetSpecialFolderPath`? – Daniel A. White Feb 07 '20 at 15:46
  • Environment.GetSpecialFolderPath is C# code. The error occurs while creating the app package under VS -> Publish -> Create App Package – Alexander Gensler Feb 07 '20 at 15:53
  • @DanielA.White Could you please share us how does your automatic update mechanism works and how does it download updates by itself into the somerandomfolder? – Amy Peng - MSFT Feb 12 '20 at 07:35
  • @AmyPeng-MSFT you can find the code here: https://github.com/gensleralexander/autoupdate_test/ – Alexander Gensler Feb 15 '20 at 15:07
  • @AlexanderGensler Thanks for sharing the sample. Do you mean that when using this code: File.WriteAllBytes(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "JACB\\UpdateDownloads\\Release.zip"), bytes); it shows the incorrect path or it still can not meet your requirement? – Amy Peng - MSFT Feb 20 '20 at 09:50
  • @AmyPeng-MSFT the problem is not downloading my update from the repository release, my problem is, that when I publish the App as sideloaded UWP Application, Visual Studio does not accept any system variables like %appdata% in the Path, where the .appinstaller is located. – Alexander Gensler Feb 21 '20 at 16:22
  • @AlexanderGensler Thanks for your information, based on my understanding currently the Visual Stuido does not accpet the system variables, I will recommend you deploy your appx into the web server as showed in here: https://learn.microsoft.com/en-us/windows/msix/app-installer/web-install-iis, after that you can paste the URL in the Visual Stuido. – Amy Peng - MSFT Feb 25 '20 at 11:14
  • @AmyPeng-MSFT thank you for your recommendation, however this sadly does not suit my approach. My app is public and I can't expect the users to install a web server only for updating the main application. – Alexander Gensler Feb 26 '20 at 12:10
  • Thanks for your update. The reason for using the web server is that the system will check if there is any update from the web server installer, if it is then it will auto update your user's application. Since your app is public and user may have no access to your web server, please try to use the Azure web service, for more information, please check: https://docs.microsoft.com/en-us/windows/msix/app-installer/web-install-azure. Besides, you can also configure package's output folder and installation URL to the same path. Then users will get both the app and future updates from the same path. – Amy Peng - MSFT Mar 02 '20 at 14:26

0 Answers0