每次开始前都必须重新安装 FiraCode Visual Studio

Have to reinstall FiraCode everytime before I start Visual Studio

在 Visual Studio 中,我使用等宽字体 FiraCode。我已经配置 Visual Studio 2019 Community(带有 Resharper 和最新更新)以使用此字体,并且在安装后它工作正常。该字体也适用于其他 editors/IDE(Visual Studio 代码,PyCharm)。但是每次重启我的机器后,我都必须重新安装 FiraCode 才能让字体在 VS 中工作。但是,在其他提到的 editors/IDE 中,该字体无需重新安装 FiraCode 即可工作。

FiraCode字体存在于VS选项的字体列表中并被选中。重新安装后,FiraCode 字体仍处于选中状态,但现在它在编辑器中也显示为已用字体。

如果我不必每次都重新安装字体,我会喜欢它(因为我经常忘记它。这意味着关闭 VS,安装字体,打开 VS,等待 Resharper(再次)完成)。有人有解决方案吗?解决方法是以某种方式在每次启动时自动重新安装字体。

几天来我一直遇到同样的问题,我觉得每次重启机器后都要一遍又一遍地安装字体真的很烦人,所以我决定自动化这个过程。

我通过 Michael Murgolo 找到了 this post,它使用 Powershell 脚本安装字体。

使用 Powershell 脚本,我所要做的就是创建一个包含以下行的 .bat 文件:

@echo off
PowerShell Set-ExecutionPolicy RemoteSigned
PowerShell -command "& '%~dp0Add-Font.ps1' -path '%~dp0FiraCode-Regular.ttf'"

如果字体与 Powershell 脚本不在同一文件夹中,则需要指定字体所在的路径。

在获得安装字体的 .bat 文件后,我必须确保它在每次启动时得到 运行。为此,我使用了 Task Scheduler 并创建了一个新任务 "Run with the highest privileges" 复选框已选中。

完成所有这些步骤后,FiraCode 字体会在每次启动时自动安装,当您打开 Visual Studio.

时就可以使用了。

希望对您有所帮助。