Álvaro García
Álvaro García

Reputation: 19386

Is it possible to get the version of an assembly that is in internet, like onedrive?

To get the version of an assembly locally I use this code:

Version myVersion = AssemblyName.GetAssemblyName(myPathToDll).Version;

This has the advantage that doesn't load the assembly in memory, so it is not blocked and also I don't need to transfer the whole dll if it is a remote server inside the LAN.

However, I am wondering if there are some way to check the version of the dll if this dll is the cloud, for example in onedrive or a webpage... etc.

I would like to avoid to have to download the file to the local computer and check it, because my idea it is develop an update application that checks updates at startup and to download all the dlls would make the application very slow in the startup.

Thanks.

Upvotes: 1

Views: 54

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 157048

You can't do that using the .NET Framework by default. AssemblyName.GetAssemblyName doesn't support HTTP.

What you could do is this:

  • Make a HttpWebRequest to the assembly;
  • Read the first X bytes to read the metadata from the assembly;
  • Dissemble the metadata and read the version.

This is a lot of work, and I can't help you with the code for it. You need to think whether it is worth the time.

Another option could be a web service that does all that for you. That might be the more straightforward option.

Upvotes: 1

Related Questions