How do you get the path to SignTool.exe when using Visual Studio 2012?
In Visual Studio 2010, you could use
The following is a more generic approach that can be used to find and set the SignToolPath
variable based upon the build machine's specific configuration; by reading the registry:
$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot81', null, RegistryView.Registry32, RegistryView.Default))
$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot', null, RegistryView.Registry32, RegistryView.Default))
$(WindowsKitsRoot)bin\$(Platform)\
This assumes that $(Platform)
resolves to one of arm
, x86
, or x64
. Replace the $(Platform)
macro with the appropriate directory otherwise.
EDIT (2017.07.05):
Here is an updated
that defers to the new Windows 10 Kit and coerces the ($Platform)=='AnyCPU'
to x86
:
$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot10', null, RegistryView.Registry32, RegistryView.Default))
$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot81', null, RegistryView.Registry32, RegistryView.Default))
$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot', null, RegistryView.Registry32, RegistryView.Default))
$(WindowsKitsRoot)bin\x86\
$(WindowsKitsRoot)bin\$(Platform)\