Bruse
Bruse

Reputation: 7

Get exe file version information from GitHub using c#

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.

Upvotes: 0

Views: 289

Answers (1)

VonC
VonC

Reputation: 1328712

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).

Upvotes: 0

Related Questions