'Publish WPF clickonce application to github

I have published my wpf project to the dir publish and it is under source control (github) So I want to add a download link to my readme.md and according to: Is it possible to offer a ClickOnce installer on Github? I should just add this in my markdown:

[Download the app](https://rawgithub.com/jphellemons/downloadyoutube/master/publish/setup.exe "Download the app")

I added https://rawgithub.com/jphellemons/DownloadYouTube/master/publish/ in the second publish step: enter image description here

but that does not work. What step did I miss? Is it perhaps related to the error https://stackoverflow.com/questions/28157811/publish-click-once-to-github

Thanks to the comment of vilicvane I have this working setup.exe download link https://github.com/jphellemons/DownloadYouTube/blob/master/DownloadYouTube/publish/setup.exe?raw=true

but the setup.exe references the wrong .application file...

An error occurred trying to download 'https://rawgithub.com/jphellemons/DownloadYouTube/master/publish/DownloadYouTube.application'.

I have seen a working method externally hosting the blob: https://github.com/Code52/carnac so there is no way to keep everything on github?



Solution 1:[1]

You can use a RawGit URL, which puts the correct Content-Type headers on the responses. Example:

https://cdn.rawgit.com/Microsoft/RESX-Unused-Finder/master/publish/ResxUnusedFinder.application

(Edit) RawGit is shutting down. I don't know of an alternative way to serve up the .application file with the correct Content-Type. I've moved to my own hosting.

Solution 2:[2]

Use the following paths:

Specify URL to install: This is the server address from where the setup will install your application from.

Update Path: This is the server address from where the setup will check for updates (using the Publish.html in the specified folder path)

You can use Raw Github URLs of PUBLIC repositories to mimic a shared folder (for FREE). Follow these steps:

Video Demonstration:: https://www.youtube.com/watch?v=iMEGtrjMXPU)

  1. If your project isn't on github, create a repository and push your code there. It has to be public.
  2. On your computer, create a folder called 'published' in the root of your repository. Make sure this folder is not ignored in the .gitignore
  3. Create a file called .gitattributes in this /published folder. Add the following contents
*.manifest binary
*.application binary
*.deploy binary
*  -text
  1. How commit and push to the github repository. Navigate to this file in the repository click on the RAW button. Copy the URL address till '/publish/'. It will look like this
    https://raw.githubusercontent.com/{your-account-name}/{your-repo-name}/{branch}/published/
  2. In the clickonce installer enter the following paths
    1. Publish Path: {repo-path}/pubhished
    2. Install Path: https://raw.githubusercontent.com/{your-account-name}/{your-repo-name}/{branch}/published/ This the the server address from where the setup will install your application from.
    3. Update Path: https://raw.githubusercontent.com/{your-account-name}/{your-repo-name}/{branch}/published/ This the the server address from where the setup will check for updates.
      NOTE: Use this link to navigate through the clickonce installer:
      https://docs.microsoft.com/en-us/visualstudio/deployment/quickstart-deploy-using-clickonce-folder?view=vs-2022.
      Make sure the check the 'Create Desktop Shortcut' option before publishing. Now commit and push your code.
  3. Now in the /published folder click on the setup to install the application. This will connect the the github servers to download and install the required files on your computer in the directory C:\Users\vib28\AppData\Local\Apps\2.0.
  4. To publish an update for the application follow these steps
    1. Make the changes to your c# applicaiton.
    2. Publish the application again (to the same folder /published). The revision number should increase, and there should be a new folder added to the location /published/Application Files
    3. Commit and push your code to github. Now the raw files have been updated. So whenever the client runs his application, it will automatically prompt for downloading the update.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2