【发布时间】:2017-09-28 14:29:18
【问题描述】:
我有一个用 Visual Studio .NET 2003 制作的旧版控制台应用程序。 我试图在构建时生成的 .exe 中嵌入清单文件但没有成功,因为我想避免在我的应用程序启动时弹出 Windows 7 Ultimate 中的 UAC。
所以我的清单文件在下面,名为 MyTestApp.exe.manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="IsUserAdmin"
type="win32"/>
<description>SDPUpdater for ServiDirPlus</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
然后在 Visual Studio .NET 2003 中,在构建后操作中,我编写以下命令:
"C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\Tools\Bin\winnt\mt.exe" -manifest "$(ProjectDir)$(TargetFileName).manifest"
考虑到:
$(ProjectDir) : C:\MyProjects\ConsoleApps\MyTestApp\
$(TargetFileName) : MyTestApp.exe
我的清单文件 MyTestApp.exe.manifest 位于 C:\MyProjects\ConsoleApps\MyTestApp\
但出现以下错误:
Performing Post-Build Event...
Microsoft (R) Side-By-Side Manifest Tool 1.0.0.0
Copyright (C) Microsoft Corporation 2000-2001. All Rights Reserved.
Nothing to do!
Modes of operation:
-hashupdate Update hashes of member files
-makecdfs Generate CDF files to make catalogs
-verbose Disply piles of debugging information
Modifiers:
-manifest <foo.man> The name of the manifest to work with
Normal usage: mt.exe -hashupdate -makecdfs -manifest foo.man
Project error: A tool returned an error code from the build event
Post-Build Event failed
我想我必须向 mt.exe 表明我的清单文件必须嵌入 MyTestApp.exe 但我不知道如何因为 mt.exe v1.0.0.0 只有 1 个修饰符(清单),它没有提供任何方式来指示我的 MyTestApp.exe 文件。
【问题讨论】:
-
问得太晚了 14 年。您找到了更新 VS 版本的好理由,是时候了。
标签: c# visual-studio manifest uac