SignTool.exe或"Windows Kits"的路径使用Visual Studio 2012时的目录 [英] Path to SignTool.exe or "Windows Kits" directory when using Visual Studio 2012

查看:309
本文介绍了SignTool.exe或"Windows Kits"的路径使用Visual Studio 2012时的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual Studio 2012时如何获取SignTool.exe的路径?

How do you get the path to SignTool.exe when using Visual Studio 2012?

在Visual Studio 2010中,您可以使用

In Visual Studio 2010, you could use

<Exec Command="&quot;$(FrameworkSDKDir)bin\signtool.exe&quot; sign /p ... />

$(FrameworkSDKDir)的位置

"c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\"

但是在Visual Studio 2012中,$(FrameworkSDKDir)

But in Visual Studio 2012, $(FrameworkSDKDir) is

 "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\"

并且SignTool在

and SignTool is in

 "c:\Program Files (x86)\Windows Kits\8.0\bin\x64\"

除了硬编码(我尝试过FrameworkSDKDirWindowsSDKDir,但都指向v8.0A目录)之外,是否有其他方法可以获取该目录的路径.

Is there a way of getting the path to this directory other than hard coding (I've tried FrameworkSDKDir and WindowsSDKDir, but both point to the v8.0A directory).

(我知道 SignFile MSBuild 任务,但由于它不接受证书密码,因此无法使用.)

(I am aware of the SignFile MSBuild task, but I can't use that as it doesn't accept certificate passwords.)

推荐答案

我遇到了同样的问题.从Visual Studio 2012命令提示符运行生成可以运行,但是在IDE中失败.寻找详细的或诊断性的日志后,我找到了该文件的默认位置是什么MSBuild日志?,它告诉我Visual Studio无法提供我真正需要的诊断信息.

I just ran into the same issue. Running the build from a Visual Studio 2012 Command Prompt worked, but it was failing in the IDE. Looking for a detailed or diagnostic log led me to What is the default location for MSBuild logs?, which told me that Visual Studio can't give the diagnostic information I really needed.

这是我最终要解决的问题.

Here's what I finally did to fix it.

打开一个正常的命令提示符(不是Visual Studio命令提示符),然后通过完全限定MSBuild的路径(%SystemRoot%\ Microsoft.NET \ Framework \ v4.0.30319 \ MSBuild.exe),从中运行msbuild.最终,这给了我与Visual Studio 2012中相同的错误消息(错误代码9009).

Open a normal Command Prompt (not the Visual Studio Command Prompt), and run msbuild from that by fully-qualifying the path to MSBuild (%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe). This finally gave me the same error message (error code 9009) that I had been receiving in Visual Studio 2012.

然后,通过附加/v:diag开关,使用诊断"日志记录(显示所有属性和项目值)运行相同的构建.

Then, run the same build using "diagnostic" logging (which shows all property and item values) by appending the /v:diag switch.

从此输出中,我了解到它确实具有一些新属性,可用来获取signtool.exe的位置(如下所示):

From this output, I learned that it does have some new properties that I could use to get the location of signtool.exe (excerpt below):

windir = C:\Windows
windows_tracing_flags = 3
windows_tracing_logfile = C:\BVTBin\Tests\installpackage\csilogfile.log
WindowsSDK80Path = C:\Program Files (x86)\Windows Kits\8.0\
WIX = C:\Program Files (x86)\WiX Toolset v3.7\

因此,我对此问题的解决方案是将以下内容添加到我的* .targets文件中:

So, my solution to this problem was to add the following to my *.targets file:

<SignToolPath Condition=" Exists('$(WindowsSDK80Path)bin\x86\signtool.exe') and '$(SignToolPath)'=='' and '$(PROCESSOR_ARCHITECTURE)'=='x86' ">$(WindowsSDK80Path)bin\x86\signtool.exe</SignToolPath>
<SignToolPath Condition=" Exists('$(WindowsSDK80Path)bin\x64\signtool.exe') and '$(SignToolPath)'=='' and '$(PROCESSOR_ARCHITECTURE)'=='AMD64' ">$(WindowsSDK80Path)bin\x64\signtool.exe</SignToolPath>

希望这对您也有帮助.我包括了如何达到这一目的的序言,因为还有其他一些属性可能更适合您的目的.

Hope this helps you, too. I included the preamble of how I got to this point because there are other properties available that may be better suited for your purposes.

这篇关于SignTool.exe或"Windows Kits"的路径使用Visual Studio 2012时的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆