Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Write a file with File Version Information attached

Tags:

c#

.net

file-io

Is there anyway to say... Include a version number when creating a text file?

Basically, my process is writing a text file that I need to check if there's a newer version available. My plan was to use FileVersionInfo to determine the current version and the version on the PC. However, I can't figure out how to write the file to the PC with a version attached to the file.

Any ideas?

like image 652
John Avatar asked Dec 06 '25 04:12

John


1 Answers

Typical options here include;

  • hashing the contents and comparing that
  • relying onthe audit dates
  • storing version in the file and
  • storing version in the first line of the file
  • using file-watcher events (unreliable by itself, by most accounts)
  • using the alternative data streams in NTFS

But no; plain text files don't have much associated metadata by themselves

like image 193
Marc Gravell Avatar answered Dec 08 '25 18:12

Marc Gravell