Update DLL RC info from powershell

521 Views Asked by At

I'm trying to update/add some RC information in DLL directly from the Powershell.

I have found how I can get it but I didn't found how set some field like SpecialBuild or PrivateBuild.

PS C:\> (gi .\mydll.dll).VersionInfo | fl

OriginalFilename  : mydll.dll
FileDescription   : mydll.dll
...............................
PrivateBuild      : 32572
SpecialBuild      : NOT_HOTFIX
FileVersionRaw    : 17.3.0.12013
ProductVersionRaw : 17.3.0.12013

PS C:\> (gi .\mydll.dll).VersionInfo | gm


   TypeName : System.Diagnostics.FileVersionInfo

Name               MemberType     Definition
----               ----------     ----------
Equals             Method         bool Equals(System.Object obj)
GetHashCode        Method         int GetHashCode()
GetType            Method         type GetType()
ToString           Method         string ToString()
Comments           Property       string Comments {get;}
.................................................
PrivateBuild       Property       string PrivateBuild {get;}
ProductBuildPart   Property       int ProductBuildPart {get;}
ProductMajorPart   Property       int ProductMajorPart {get;}
ProductMinorPart   Property       int ProductMinorPart {get;}
ProductName        Property       string ProductName {get;}
ProductPrivatePart Property       int ProductPrivatePart {get;}
ProductVersion     Property       string ProductVersion {get;}
SpecialBuild       Property       string SpecialBuild {get;}
FileVersionRaw     ScriptProperty System.Object FileVersionRaw {get=New-Object System.Version -ArgumentList @(...
ProductVersionRaw  ScriptProperty System.Object ProductVersionRaw {get=New-Object System.Version -ArgumentList @(...

As you can see, properties are get only here.

So do you know how I can update theses fields ?

Thanks in advance for your help ;)

1

There are 1 best solutions below

4
Andrey Marchuk On

Update fields possible with a tool like Resource Hacker, or verpatch, but it's not recommended. If the dll is yours, it's much easier to update it before compilation.

One of the downsides of patching compiled dll is that if it's signed, the signature will no longer be valid. Also, sometimes patching may result in a corrupted dll.

Is there any particular reason why you want to change it after compilation?