如何使用 mt.exe 将清单添加到可执行文件?
我正在尝试使用 Windows SDK 中的 mt.exe 将清单添加到没有清单的可执行文件,使用以下命令行:
C:\winsdk61>mt.exe -nologo -manifest "r:\shared\hl.exe.manifest" -updateresource:"r:\shared\hl33m.exe;#1"
不幸的是,当我这样做时,我收到此错误:
mt.exe : general error c101008c: Failed to read the manifest from
the resource of file "r:\shared\hl33m.exe". The specified resource
type cannot be found in the image file.
当然资源是在文件中找不到 - 该文件没有清单,这就是我想添加一个的原因。
如何将清单附加到可执行文件?这不是应该很简单吗?
I'm trying to use mt.exe from the Windows SDK to add a manifest to an executable file that doesn't have one, using the following command line:
C:\winsdk61>mt.exe -nologo -manifest "r:\shared\hl.exe.manifest" -updateresource:"r:\shared\hl33m.exe;#1"
Unfortunately, when I do, I get this error:
mt.exe : general error c101008c: Failed to read the manifest from
the resource of file "r:\shared\hl33m.exe". The specified resource
type cannot be found in the image file.
Of course the resource wasn't found in the file - the file doesn't have a manifest, that's why I want to add one.
How can I append a manifest to an executable file? Shouldn't this be simple?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该使用 /outputresource 而不是 /updateresource:。
正确的命令行是:
You should use /outputresource instead of /updateresource:.
The correct command line would be:
这对我的 VS 2005 有用:
在您的可执行项目上,添加以下构建后事件:
“$(DevEnvDir)..\Tools\Bin\mt.exe”-nologo -manifest“$(TargetPath).manifest”-outputresource:“$(TargetPath)”
希望这会有所帮助。祝你好运! -马特·埃斯特拉克
This worked for me for VS 2005:
On your executable project, add the following post-build event:
"$(DevEnvDir)..\Tools\Bin\mt.exe" -nologo -manifest "$(TargetPath).manifest" -outputresource:"$(TargetPath)"
Hope this helps. Good luck! -Matt Esterak
您还可以像这样使用它来将清单嵌入 EXE 文件中:
mt.exe -nologo -manifest "r:\shared\hl.exe.manifest" -outputresource:"r:\shared\hl33m.exe;1"
You can also use it like this to embed the manifest inside the EXE file:
mt.exe -nologo -manifest "r:\shared\hl.exe.manifest" -outputresource:"r:\shared\hl33m.exe;1"