windows UAC提示显示msi的临时随机程序名,能显示正确的名字吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4315840/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The UAC prompt shows a temporary random Program Name for msi, can the correct name be displayed?
提问by Scott Langham
I'm building an MSI installer for windows and sign the installer using signtool. When I run the .msi to test it, the UAC (User Account Control) prompt shows up to ask me if I want to allow the installation to proceed. That's fine, but the prompt shows a number of fields, and for the Program Name field it displays something like "403b3.msi". This is not the name of the msi I'm running.
我正在为 Windows 构建一个 MSI 安装程序,并使用 signtool 对安装程序进行签名。当我运行 .msi 进行测试时,会出现 UAC(用户帐户控制)提示,询问我是否允许继续安装。这很好,但提示显示了许多字段,对于程序名称字段,它显示类似“403b3.msi”的内容。这不是我正在运行的 msi 的名称。
How can I get the correct Program Name to be displayed?
如何获得要显示的正确程序名称?
回答by Scott Langham
Use the /d command line argument with the required program name when executing signtool to sign the msi.
执行 signtool 对 msi 进行签名时,使用带有所需程序名称的 /d 命令行参数。
It appears that the windows installer creates a temporary copy of the msi file and assigns it a generated name before running it. If you don't use /d with signtool, you get to see the temporary filename which isn't very useful for your users.
Windows 安装程序似乎创建了 msi 文件的临时副本,并在运行之前为其分配了一个生成的名称。如果您不将 /d 与 signtool 一起使用,您将看到临时文件名,这对您的用户来说不是很有用。
回答by JJS
this is an applied version of @Scott-langham's comment.
这是@Scott-langham 评论的应用版本。
this was directly from the PostBuildEvent of a visual studio installer project - VDPROJ file
这直接来自 Visual Studio 安装程序项目的 PostBuildEvent - VDPROJ 文件
set signtool="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\signtool.exe"
set timestampurl=http://timestamp.digicert.com
set certpath="$(ProjectDir)CodeSigningCert.pfx"
:: Setup in your user environment variables
:: using something with low sort order to force off screen ZZCODECERTPASSWORD
if []==[%ZZCODECERTPASSWORD%] (
echo must set code signing certificate in ZZCODECERTPASSWORD environment variable. stopping build.
exit /b 2
)
:: need the filename with extension that is being generated
FOR /f %%i IN ("$(BuiltOuputPath)") DO (
SET outputfilename=%%~nxi
)
%signtool% sign /t %timestampurl% /f %certpath% /p %CODECERTPW% /d %outputfilename% "$(BuiltOuputPath)"
IF ERRORLEVEL 1 (
echo failed to sign MSI
exit /b 3
)
%signtool% sign /t %timestampurl% /f %certpath% /p %CODECERTPW% "$(ProjectDir)$(Configuration)\Setup.exe"
IF ERRORLEVEL 1 (
echo failed to sign boostrap setup EXE
exit /b 4
)