Mouse right click on a file -> Properties -> Details, you will see a Original filename
property for some files, just as following:
So, my question: How to modify the Original filename
property of an existed file. I need to achieve it in C# code.
EDIT:
Although @CodeCaster marked it as duplicate, however 3 answers presents there, but none of them work well. I have tried the resourcelib in the second answer, it can modify the Original filename
, but the new value can't update to the Windows Properties
dialog.
string filename = @"C:\Users\Iron\Desktop\WpfApp1.exe";
VersionResource versionResource = new VersionResource();
versionResource.LoadFrom(filename);
Console.WriteLine("File version: {0}", versionResource.FileVersion);
versionResource.FileVersion = "1.2.3.4";
StringFileInfo stringFileInfo = (StringFileInfo)versionResource["StringFileInfo"];
Console.WriteLine("Original filename: {0}", stringFileInfo["OriginalFilename"]);
stringFileInfo["OriginalFilename"] = "New Original filename\0";