0

I have my file in my GitHub repository. I can get my exe file version only after downloaded that exe file into my local machine.

var file1 = $"https://raw.githubusercontent.com/{get-id}/AutoUpdate/main/hello.exe";

var desktop = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
                    string zipFile = desktop + "\\hello.exe";
                    string fileName = desktop + "\\hello.exe";
                    wc.DownloadFile(file1, zipFile);

var versionInfo = FileVersionInfo.GetVersionInfo(fileName);
                        var existVersion = versionInfo.ProductVersion;

The above existVersion will be my exe file's version. Which is downloaded from GitHub. Here my hello.exe file size will be lessee. I want to use this same concept for some large size exe application. So, before downloading that file into my local machine. I want to check my version of exe file which is placed in the GitHub.

Need to download that exe file into my local machine via c# code. Need to check the exe file version before download into my local machine.

I am checking this version for find the latest version of that exe file. Every time I want to download latest version file from GitHub.

Bruse
  • 7
  • 3
  • Github doesn't make such file metadata available through an API or otherwise, you'd need to download the file to read that information. Have you considered using the Releases feature, and/or named branches or tags? – gunr2171 Oct 31 '22 at 02:48
  • I am trying to do auto-update process. I having my updated version exe in my GitHub When I start the lower version exe from my local machine. It really want me ask me for update. That updated should be check from the GitHub updated exe. Consider my file size will be 4GB. And I don't know whether the GitHub exe file updated or not. But, I need to download that into my local machine. and I am checking the version. If the both local and GitHub version's same means. here my running time will waste. Thats why i am checking the version before download. – Bruse Oct 31 '22 at 02:58
  • Hi @gunr2171 Can you Please update If any possible way to achieve it. – Bruse Oct 31 '22 at 03:07

1 Answers1

0

First, an executable is generally not part of a GitHub repository, but a GitHub release, which can be:

  • associated to a tag (version number)
  • referenced as "latest" (you can query it with an API call), allowing you to detect any new version that way.

Second, if you still want to store an exe in the GitHub rpeository itself, then you would need to store an additional hello.exe.version with the metadata you need (version).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi @VonC Thanks for your suggestion. Is there any reference or document for this implementation. – Bruse Nov 01 '22 at 02:58
  • @Bruse You can [call the API directly (in CSharp)](https://gist.github.com/MaximRouiller/74ae40aa994579393f52747e78f26441). Or [use dedicated libraries](https://stackoverflow.com/q/6427023/6309) – VonC Nov 01 '22 at 18:31