1

Mouse right click on a file -> Properties -> Details, you will see a Original filename property for some files, just as following:

Original filename

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";
Iron
  • 926
  • 1
  • 5
  • 16
  • 1
    The https://stackoverflow.com/questions/6024523/is-it-possible-to-set-the-originalfilename-property-for-a-net-assembly-with-vis have work in windows 7 but not work in windows 10 that I try to use [this](https://stackoverflow.com/questions/6024523/is-it-possible-to-set-the-originalfilename-property-for-a-net-assembly-with-vis) but cant change file. – lindexi Nov 24 '17 at 02:05

0 Answers0