<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Windows - 标签 - 岚の音</title><link>https://shiranosama.github.io/tags/windows/</link><description>当其贯日月，死生安足论</description><generator>Hugo 0.169.0 &amp; FixIt v1.0.0-rc.3</generator><language>zh-CN</language><managingEditor>mufeng319@gmail.com (Shirano)</managingEditor><webMaster>mufeng319@gmail.com (Shirano)</webMaster><lastBuildDate>Sun, 15 Nov 2026 23:00:51 +0800</lastBuildDate><atom:link href="https://shiranosama.github.io/tags/windows/index.xml" rel="self" type="application/rss+xml"/><item><title>「折腾日记」Win SDK APP, but VSCode</title><link>https://shiranosama.github.io/posts/b612c25/</link><pubDate>Thu, 17 Sep 2026 20:28:21 +0800</pubDate><author>mufeng319@gmail.com (Shirano)</author><guid>https://shiranosama.github.io/posts/b612c25/</guid><category domain="https://shiranosama.github.io/categories/%E6%8A%98%E8%85%BE%E6%97%A5%E8%AE%B0/">折腾日记</category><description>&lt;h2 class="heading-element" id="环境准备"&gt;&lt;span&gt;环境准备&lt;/span&gt;&#10; &lt;a href="#%e7%8e%af%e5%a2%83%e5%87%86%e5%a4%87" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;ul&gt;&#10;&lt;li&gt;Visual Studio Code&#10;&lt;ul&gt;&#10;&lt;li&gt;C# 拓展&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Visual Studio Build Tools&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;关于C# dev kit拓展，实际上这拓展不好用，每次都要登录不说，交互逻辑还烂，不然你猜它为啥评分2.5/5&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 class="heading-element" id="启动环境的正确姿势"&gt;&lt;span&gt;启动环境的正确姿势&lt;/span&gt;&#10; &lt;a href="#%e5%90%af%e5%8a%a8%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a3%e7%a1%ae%e5%a7%bf%e5%8a%bf" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;ul&gt;&#10;&lt;li&gt;启动Windwos Terminal配置文件——&lt;strong&gt;Developer Command/PowerShell Prompt for VS 18&lt;/strong&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;如果没有Windows Terminal，可以在Visual Studio Installer中点击Build Tools的启动按钮&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;在终端会话中执行&lt;code&gt;Code&lt;/code&gt;命令以打开VS Code，这会正确继承Build Tools的环境变量&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 class="heading-element" id="上下文菜单集成"&gt;&lt;span&gt;上下文菜单集成&lt;/span&gt;&#10; &lt;a href="#%e4%b8%8a%e4%b8%8b%e6%96%87%e8%8f%9c%e5%8d%95%e9%9b%86%e6%88%90" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;ul&gt;&#10;&lt;li&gt;文件夹右键菜单：&#10;&lt;pre&gt;&lt;code&gt;Windows Registry Editor Version 5.00&#10;&#10;[HKEY_CLASSES_ROOT\Directory\shell\MSVCVSCode]&#10;@=&amp;#34;Code with MSVC&amp;#34;&#10;&amp;#34;Icon&amp;#34;=&amp;#34;C:\\Program Files\\Microsoft VS Code\\Code.exe&amp;#34;&#10;&#10;[HKEY_CLASSES_ROOT\Directory\shell\MSVCVSCode\Command]&#10;@=&amp;#34;\&amp;#34;C:\\Program Files\\PowerShell\\7\\pwsh.exe\&amp;#34; -NoExit -WorkingDirectory \&amp;#34;%V\&amp;#34; -Command \&amp;#34;&amp;amp;{Import-Module \&amp;#34;\&amp;#34;\&amp;#34;C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll\&amp;#34;\&amp;#34;\&amp;#34;; Enter-VsDevShell xxxxxxxx -SkipAutomaticLocation -DevCmdArguments \&amp;#34;\&amp;#34;\&amp;#34;-arch=x64 -host_arch=x64\&amp;#34;\&amp;#34;\&amp;#34;; code -n \&amp;#34;%V\&amp;#34;}\&amp;#34;&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;文件夹背景右键菜单&#10;&lt;pre&gt;&lt;code&gt;Windows Registry Editor Version 5.00&#10;&#10;[HKEY_CLASSES_ROOT\Directory\Background\shell\MSVCVSCode]&#10;@=&amp;#34;Code with MSVC&amp;#34;&#10;&amp;#34;Icon&amp;#34;=&amp;#34;C:\\Program Files\\Microsoft VS Code\\Code.exe&amp;#34;&#10;&#10;[HKEY_CLASSES_ROOT\Directory\Background\shell\MSVCVSCode\Command]&#10;@=&amp;#34;\&amp;#34;C:\\Program Files\\PowerShell\\7\\pwsh.exe\&amp;#34; -NoExit -WorkingDirectory \&amp;#34;%V\&amp;#34; -Command \&amp;#34;&amp;amp;{Import-Module \&amp;#34;\&amp;#34;\&amp;#34;C:\\Program Files (x86)\\Microsoft Visual Studio\\18\\BuildTools\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll\&amp;#34;\&amp;#34;\&amp;#34;; Enter-VsDevShell xxxxxxxx -SkipAutomaticLocation -DevCmdArguments \&amp;#34;\&amp;#34;\&amp;#34;-arch=x64 -host_arch=x64\&amp;#34;\&amp;#34;\&amp;#34;; code -n \&amp;#34;%V\&amp;#34;}\&amp;#34;&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;其中：&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;MSVCVSCode&lt;/code&gt;是键名，可随意更改&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Code with MSVC&lt;/code&gt;是菜单项名&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Icon&lt;/code&gt;是菜单图标，这里直接指向VsCode获取图标&lt;/li&gt;&#10;&lt;li&gt;Command键的值来源于Windows Terminal配置文件的&lt;strong&gt;命令行&lt;/strong&gt;项，将其中的pwsh替换为绝对路径并添加了&lt;code&gt;-WorkingDirectory %V&lt;/code&gt;用于指定工作目录，在-Command选项参数的结尾添加&lt;code&gt;code -n %V&lt;/code&gt;以启动VsCode&#10;&lt;ul&gt;&#10;&lt;li&gt;其中的&lt;strong&gt;路径&lt;/strong&gt;、&lt;strong&gt;xxxxxxxxx&lt;/strong&gt;并非固定，取决于Visual Studio Installer生成的具体值，请自行查看&lt;/li&gt;&#10;&lt;li&gt;%V在传递给shell时会被替换为右键点击的目录&lt;/li&gt;&#10;&lt;li&gt;code不使用绝对路径是因为pwsh会自己加载PATH&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 class="heading-element" id="dont-do-this"&gt;&lt;span&gt;Don&amp;rsquo;t Do This&lt;/span&gt;&#10; &lt;a href="#dont-do-this" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;ul&gt;&#10;&lt;li&gt;不要将Build Tools直接硬塞进环境变量，这将彻底污染PATH变量，不是一个明智的选择&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 class="heading-element" id="cli工具"&gt;&lt;span&gt;CLI工具&lt;/span&gt;&#10; &lt;a href="#cli%e5%b7%a5%e5%85%b7" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;h2 class="heading-element" id="dotnet"&gt;&lt;span&gt;DotNet&lt;/span&gt;&#10; &lt;a href="#dotnet" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;dotnet命令负责.NET项目的编译、调试、发布，执行时，只需将当前项目的.sln文件传递给CLI即可：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;# 一例：编译项目&#10;dotnet build ./Thisissln.sln /property:GenerateFullPaths=true /p:Configuration=Debug /p:Platform=x64 /consoleloggerparameters:NoSummary&#10;&#10;# 一例：发布项目为MSIX&#10;dotnet publish ./Thisissln.sln /property:GenerateFullPaths=true /p:Configuration=Release /p:Platform=x64 /consoleloggerparameters:NoSummary /p:GenerateAppxPackageOnBuild=true&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;Configuration&lt;/code&gt;对应项目配置&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Platform&lt;/code&gt;对应平台架构&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;GenerateAppxPackageOnBuild&lt;/code&gt;告诉MSBuild生成AppxPackage&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;为什么使用/p而不是-c/-r？&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;因为/p是直接传递MSBuild参数，而后者是进行映射，有时候会出现与MSBuild当前参数不一致而导致报错，解决办法就是写两遍，一遍-r win-x64，一遍/p:Platform=x64。既然如此，那我为何不直接传MSBuild参数跳过中间商呢&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 class="heading-element" id="makeappx"&gt;&lt;span&gt;makeappx&lt;/span&gt;&#10; &lt;a href="#makeappx" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;ul&gt;&#10;&lt;li&gt;makeappx命令负责将dotnet生成的产物打包成.msix格式，将产物文件夹传递即可：&#10;&lt;pre&gt;&lt;code&gt;# 一例：打包项目&#10;makeappx pack /d .\win-x64\ /p Reorld.msix /o&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;注：&#10;&lt;ul&gt;&#10;&lt;li&gt;确保你的产物文件夹包含msix打包所需文件&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 class="heading-element" id="signtool"&gt;&lt;span&gt;signtool&lt;/span&gt;&#10; &lt;a href="#signtool" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;ul&gt;&#10;&lt;li&gt;signtool命令负责签名程序包，需要提供一个可用的代码签名证书：&#10;&lt;pre&gt;&lt;code&gt;# 一例：签名MSIX&#10;# signtool默认在Certificate::CurrentUser\My下寻找证书&#10;# /s 参数可指定要在命令搜索证书时打开的存储&#10;signtool sign /sha1 &amp;#39;证书Sha1&amp;#39; /fd Sha256 /td Sha256 /tr http://timestamp.digicert.com .\Reorld.msix&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;注：证书的Subject必须与项目manifest里Identity的Publisher属性一致&lt;/p&gt;&#10;&lt;h3 class="heading-element" id="找powershell给你画一张证书"&gt;&lt;span&gt;找PowerShell给你画一张证书&lt;/span&gt;&#10; &lt;a href="#%e6%89%bepowershell%e7%bb%99%e4%bd%a0%e7%94%bb%e4%b8%80%e5%bc%a0%e8%af%81%e4%b9%a6" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;ul&gt;&#10;&lt;li&gt;下面的命令生成一个用于代码签名的证书，并储存在&lt;code&gt;PSParentPath: Microsoft.PowerShell.Security\Certificate::CurrentUser\My&lt;/code&gt;下&#10;&lt;pre&gt;&lt;code&gt;New-SelfSignedCertificate -Type CodeSigningCert -Subject &amp;#34;CN=SuiBianTian&amp;#34; -CertStoreLocation Cert:\CurrentUser\My&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;导出证书&#10;&lt;pre&gt;&lt;code&gt;# 获取证书Hash&#10;Get-ChildItem -Path Cert:\CurrentUser\My\&#10;&#10;# 设置临时变量储存密码&#10;$mypwd = Read-Host -AsSecureString&#10;&#10;# 导出为pfx用于签名（一般不需要）&#10;Export-PfxCertificate -Cert &amp;#34;Cert:\CurrentUser\My\证书Hash&amp;#34; -FilePath &amp;#34;用来储存pfx的路径/Yourpfx.pfx&amp;#34; -Password $mypwd&#10;&#10;# 导出为cer用于信任/安装&#10;Export-Certificate -Cert &amp;#34;Cert:\CurrentUser\My\证书Hash&amp;#34; -FilePath &amp;#34;用来储存cer的路径/Yourcer.cer&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&#10;&lt;li&gt;如果你导出了pfx，在输入密码时强烈建议同样通过&lt;code&gt;Read-Host -AsSecureString&lt;/code&gt;获取安全字符串临时变量后使用&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;</description></item></channel></rss>