问题
I'm wondering if you can create a ClickOnce installer for a project and then host the installation folder on GitHub (via the downloads page)?
I guess by default ClickOnce publishes the installation files to a subfolder which I think is not supported on the Github downloads page but maybe there is another way.
回答1:
Yes you can.
And actually I think it's a more convenient way comparing to FTP.
- Make sure your Git is set to "commit as-is", so that you can avoid some signature issues.
- Publish your ClickOnce application to a directory in your git repository (you may want another branch for that) with the url of raw on Github as the download/update url. E.g. for repository "xxx", branch "master", directory "clickonce" of user "vilic", the url should be "https://raw.github.com/vilic/xxx/master/clickonce/"
- Commit and push your application.
BTW, you will be able to download exe file and the application is able to check and download update as you are directly using raw.github.com. However, you may not open the xml file from your browser because the MIME type of xml file would be "text/plain". But I think you can try to use Github Pages to build this server, which should response with the right MIME type.
回答2:
When I set out trying to do this, this question with @VILIC's answer was one of the things that helped. Here is my blog post detailing how ClickOnce to GitHub pages has been automated -
http://flickrdownloadr.com/blogs/blog/2013/01/15/single-click-deployment-of-wpf-application-to-github-pages/
回答3:
All of these didn't work for me: rawgithub.com, raw.github.com, raw.githubusercontent.com.
RawGit did work, because it serves the proper application/x-ms-application Content-Type header.
Example:
https://cdn.rawgit.com/Microsoft/RESX-Unused-Finder/master/publish/ResxUnusedFinder.application
Also followed this guide and added a .gitattributes file:
*.manifest binary
*.application binary
*.deploy binary
回答4:
Most things served from raw.github.com have a text/plain content type and are served with an X-Content-Type-Options: nosniff header.
You can change your url to rawgithub.com from raw.github.com, which solves the problem in VILIC VANE's answer.
来源:https://stackoverflow.com/questions/13512029/is-it-possible-to-offer-a-clickonce-installer-on-github