Hi to anyone who faced similar issues,
After referencing this link:
How do I set the version information for an existing .exe, .dll?
I was able to change dlls and exes' product version under a specific folder. This step is done after all the dlls and exes were built.
Use Resource Hacker to Extract the *.RC file from exes/ dlls :
$ResourceHackerPath = "C:\Tools\resource_hacker\ResourceHacker.EXE"
$Dllpath = "...\MySoftware\Mydll.dll"
$RCpath = "...\MySoftware\Mydll.RC"
Start-Process -FilePath "`"$ResourceHackerPath`"" -ArgumentList "-extract `"$ProductPath`",`"$RCpath`",versioninfo,," -wait
Edit product version in *.RC file :
$OriProVer = (Get-Item -literalpath $Dllpath ).VersionInfo.ProductVersion
$NewProVer = "Mysoftware 5.1 Beta 6"
(Get-Content $Dllpath).Replace($OriProVer, $NewProVer ) | Set-Content $Dllpath
Use GoRC to change *.RC file format to *.RES file:
Start-Process -FilePath "`"$GoRCPath`"" -ArgumentList "/r `"$RCpath`"" -wait
Use Resource Hacker again to add the *.RES file to the dlls or exes
$RESpath = "...\MySoftware\Mydll.RES"
Start-Process -FilePath "`"$ResourceHackerPath`"" -ArgumentList "-addoverwrite `"$Dllpath `",`"$Dllpath `",`"$RESpath`", , ," -wait
Your dlls' product version should be updated to any string that you want.
Extra tips, if you wish to update a lot of dlls and exes product version:
You can try this:
Search all the dlls and exes under a specific folder:
$directory = "...\Desktop\New Folder"
$FileNameList = Get-ChildItem -literalpath $directory -Include *.dll, *.exe -recurse | foreach-object { "{0}" -f [System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileName}
Doing the all 4 steps above in a for loop:
for ($i = 0;$i -lt $FileNameList.count;$i++){...}
Thanks & have a nice day :)