无需重新编译即可更新DLL文件版本号的实现方法咨询
无需重新编译即可更新DLL文件版本号的实现方法咨询
我手里有一些版本号不正确的.dll文件,想不用重新编译就把它们的版本号改成正确值。我找到了UpdateResource这个Windows API函数,打算通过Platform Invoke(也就是大家常说的P/Invoke)来实现这个功能。
以下是我目前写的代码:
public class UpdateBinaryResource { class VersionResourceUpdater { [DllImport("kernel32.dll", SetLastError = true)] private static extern IntPtr BeginUpdateResource(string pFileName, bool bDeleteExistingResources); [DllImport("kernel32.dll", SetLastError = true)] private static extern bool UpdateResource(IntPtr hUpdate, IntPtr lpType, IntPtr lpName, ushort wLanguage, byte[] lpData, uint cbData); [DllImport("kernel32.dll", SetLastError = tru...
备注:内容来源于stack exchange,提问作者Alfyn
相关产品推荐
相关产品推荐

