0

我正在尝试直接从 Powershell 更新/添加 DLL 中的一些 RC 信息。

我找到了如何获得它,但我没有找到如何设置一些字段,如SpecialBuildor 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 @(...

如您所见,属性只能在此处获取。

那么您知道我如何更新这些字段吗?

在此先感谢您的帮助 ;)

4

1 回答 1

1

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?

于 2016-10-28T09:55:10.857 回答