Path to SignTool.exe or “Windows Kits” directory when using Visual Studio 2012

前端 未结 7 1780
-上瘾入骨i
-上瘾入骨i 2021-01-30 09:04

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

In Visual Studio 2010, you could use



        
7条回答
  •  隐瞒了意图╮
    2021-01-30 09:16

    I assume that signtool is being used to sign the executables or dlls. With Visual Studio 2019, there is a Developer command line which offers both Developer Cmd and Developer Powershell. Both of these options can resolve the signtool automatically without worrying about the current Windows SDK.

    If we want to use the Developer Powershell from the native powershell then we just need to import the module for Developer Powershell. To import the module we need to run the following line in native powershell:

    &{Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"; Enter-VsDevShell 5ee267ff}
    

    where 5ee267ff varies for each machine. You can find it out in the Properties of Developer Powershell shortcut.

    Once the module is imported we can resolve signtool even from native powershell. In the end we can add a script in the post build event of a project such that this script imports the Developer powershell and then we can simply use signtool for signature.

提交回复
热议问题