Reputation: 1335
Last Edit: A Version number cannot be added to a generic file in Windows.
Versioning in Windows comes from a VERSIONINFO resource attached to a binary executable file such as .EXE or .DLL. This resource cannot be attached to any arbitrary file and it is not part of any Alternate Data Stream.
I had thought that the version info was stored in an Alternate Data Stream, but it is not.
Is there a way to add a program version number to the meta-data for a file in Windows that is not an executable or dll? We have a linux app. that will be stored on a Windows server and copied to Linux computers when the version changes.
Edit: I would like to Add versioning info to the file, which is kept in an Alternate File stream for the file.
I would like to write a version number to the meta data so that it could be read from a program using a method similar to this:
string fullPath = "folder_name" + "\\" + "linux_app_name";
if (File.Exists(fullPath))
{
FileAttributes fileAttributes = File.GetAttributes(fullPath);
FileVersionInfo verInfo = FileVersionInfo.GetVersionInfo(fullPath);
// todo: add version info to the file.
textBox1.AppendText("File name:\t" + Path.GetFileName(verInfo.FileName) + '\n');
textBox1.AppendText("Version Info:\t");
if (verInfo.FileVersion != null)
{
textBox1.AppendText(verInfo.FileVersion);
}
else
{
textBox1.AppendText("No Version info.");
}
}
Thanks in advance for any replies.
Upvotes: 1
Views: 2650
Reputation: 1335
I'm posting this answer in case someone else is looking for a way to add versioning to an arbitrary file in Windows that's not a Windows program file.
You can't.
Versioning in Windows comes from a VERSIONINFO resource attached to a binary executable file such as .EXE or .DLL. This resource cannot be attached to any arbitrary file and it is not part of any Alternate Data Stream.
Upvotes: 2