Windows 10 和 Visual Studio 2015 安装中缺少 Makecert?

Makecert missing from Windows 10 and Visual Studio 2015 install?

我全新安装了 windows 10 和 visual studio 2015,但在任何地方都找不到 makecert.exe。是否需要安装其他软件才能恢复此程序?

我查看了 "C:\Program Files (x86)\Microsoft SDKs\Windows\" 下的所有文件夹,但没有看到它。

我也打开了 "Developer Command Prompt for VS2015" 并尝试 运行 "makecert" 但没有找到。

安装 Windows SDK for Windows 10. If you still can't find it, try the Windows Driver kit.

正如 ShaneH 在 this question 中的回答,makecert.exe 已被弃用,我们应该使用 powershell commandlet New-SelfSignedCertificate。

New-SelfSignedCertificate -Subject "CN=Test Code Signing" -Type CodeSigningCert -KeySpec "Signature" -KeyUsage "DigitalSignature" -FriendlyName "Test Code Signing" -NotAfter (get-date).AddYears(5)


对于旧版本的 PS,可以从 TechNet 获取此脚本: https://gallery.technet.microsoft.com/scriptcenter/Self-signed-certificate-5920a7c6

为了使我的回答完整,下面是如何使用 TechNet 脚本的简要说明:

  1. 导航到上面的 link 并下载新的-SelfSignedCertificateEx.zip 文件
  2. 解压到某处
  3. 运行 PowerShell 控制台并导航至包含新文件的位置
  4. 运行 命令 .\New-SelfSignedCertificateEx 调用函数。记得 附加必要的参数。

.\New-SelfsignedCertificateEx -Subject "CN=Test Code Signing" -EKU "Code Signing" -KeySpec "Signature" -KeyUsage "DigitalSignature" -FriendlyName "Test code signing" -NotAfter [datetime]::now.AddYears(5)

如果您在使用此工具时遇到问题,请注意另外两点。

  1. 如果 PowerShell 抱怨脚本被禁用,运行 以管理员身份控制台并调用:Set-ExecutionPolicy unrestricted
  2. 如果 PowerShell 仍然拒绝 运行 它,请确保您在文件名前 prepended .\(点斜杠),因为这是必要的。

为 Windows 下载 Windows SDK 后,要安装 "makecert.exe",您只需检查 "Windows Software Development Kit"。

快速搜索我的 C: 发现 makecert.exe 似乎与 Fiddler 2 一起分发在 C:\Program Files (x86)\Fiddler2 文件夹中。这比完整的 Windows SDK 下载要小得多。

作为记录,我有 Fiddler 2 的 4.6.20171.26113 版本。