1

I have spent the last several days attempting to setup a home FTP server, but my firewall is giving me a hard time.

My goal is to emulate the functionality of a Click-Once application in a Portable .NET application. I have a finished portable EXE file with several read/write folders of data in the same directory being accessed at run time with My.Application.info.directorypath. For this reason I don't want to do a published application with an installation because many users don't have write privileges to their program files directory. In addition I have users using WINE on Mac/Linux as well as XP users. I think it will be problematic to try and get the same compatibility I have presently if I break away from being portable.

My plan is to write a second application to function as a launcher/updater. It will use a web client to read a hosted file with the current software version number. If its out of date it will prompt the user and then use WebClient.DownloadFile to download a zipped package of the newest software. Replace the old with the new and then launch the application.

The only problem is this is very virus'esk... I don't think its possible do a programmatic file download and have it just replace file in the background.

Does anyone have any good deployment tricks on how they would handle this situation? Also Anyone have a good suggestion for a file hosting location that can be read programmatically (I can use Github, but I imagine that is frowned upon...)

I am considering using Squirrel.Windows, but then none of my WINE or XP users will be able to use it.

Matt
  • 170
  • 1
  • 2
  • 15
  • 1
    Does "in the background" mean secretly? That might no be possible depending on the deployment model; the updater module may need to be run as admin. That is not altogether a bad thing - users ought to know when their software is updating something on their system. – Ňɏssa Pøngjǣrdenlarp May 10 '17 at 15:57
  • ClickOnce doesn't install to the Program Files folder, it installs the application to the user's App Data folder under My Documents. – Jason Bayldon May 10 '17 at 16:03
  • @Plutonix I don't agree that giving an application admin access simply to alert users "update required" is the right (secure) way to go about updating an application. – Jason Bayldon May 10 '17 at 16:12
  • As I said, depending on how it is deployed, it may be required. – Ňɏssa Pøngjǣrdenlarp May 10 '17 at 16:13
  • @Plutonix I dont nessecarily mean secret. I dont want to have to have a call to 'Process.Start(URL)' and have users manually place the archive file. Just want a MessageBox prompt with Yes/No for do you want to update. – Matt May 10 '17 at 16:59
  • 1
    @Matt I would still be partial to ClickOnce deployment as you could be simplifying everything and deploying right to Azure through VS. VS deploys a new manifest, and your application pings the manifest-endpoint to validate and update to the latest version (potentially asking the user). You however, would have to test it across devices, it looks like ClickOnce is supported on WINE, you just need to have .NET installed. I know ClickOnce works fine on XP, Win 7 and Win 10. But whatever you choose, good luck! – Jason Bayldon May 10 '17 at 18:41
  • Thank you sir. Deployment is very confusing. – Matt May 10 '17 at 19:39

1 Answers1

2

You could potentially have the Update Application act as a "launcher" that verifies if an update is required, optionally downloads it to a subfolder and unpacks it, and then runs the actual application.

SomeLauncher.exe
-> application sub-folder -> TheAppToRun.exe

I think this way you avoid having problems locking the files.

Edit: WebClient https://msdn.microsoft.com/en-us/library/ez801hhe(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2

    Dim client As New System.Net.WebClient()
    client.DownloadFile("http://path/to/file.zip", "c:\some\path")
    client.Dispose();
Jason Bayldon
  • 1,296
  • 6
  • 24
  • 41
  • Jason this exactly what I was attempting to describe above. The problem is the download portion. How do I implement a 'WebClient.DownloadFile' from a .NET application? I am having trouble getting anything other than the html for the files rather than the actual RAW file. Perhaps it was just a limitation of the file hosting site I was using. – Matt May 10 '17 at 16:56
  • 1
    @Matt I am not aware of handling that file type but I linked to the documentation for MSDN. See if it works for your file type. – Jason Bayldon May 10 '17 at 17:05
  • That is how I implemented it in my "Launcher" App. It must be my file host. Can you recommend a file host that allows programmatic file download? Im looking into Azure now. – Matt May 10 '17 at 17:09
  • 1
    I don't think hosts care specifically about "programmatic" file downloads, simply that your current provider probably blocks that extension from being downloaded. Depending on your needs, you could look at Azure as your bandwidth costs will probably end up being relatively cheap. Shared hosting may be more economically viable if you need more functionality than simple file hosting. Be sure to use the pricing calculators for Cloud options but IMO try Azure first as you probably get a free trial. – Jason Bayldon May 10 '17 at 18:34