c# - 注册 c# .net core 控制台应用程序以在 macOS 上的系统启动时启动

标签 c# macos .net-core startup macos-catalina

我如何在.net core中以编程方式告诉MacOS Catalina在系统启动时启动我的控制台应用程序?我知道我可以通过首选项手动添加程序:

Open System Preferences.
Go to Users & Groups.
Choose your nickname on the left.
Choose Login items tab.
Press “+” and choose the app you’d like add.
Then restart your Mac to see the changes.

但是如何以编程方式执行此操作呢?这在 .net core/zsh 脚本中可能吗?

最佳答案

您需要将应用程序的 plist 添加到用户的 LaunchAgents 文件夹中。 Mac 上的路径是 /Library/LaunchAgents

如果您希望它在用户登录 Mac 之前启动,您可以将其添加到位于以下位置的 LaunchDaemons 文件夹:/Library/LaunchDaemons

关于c# - 注册 c# .net core 控制台应用程序以在 macOS 上的系统启动时启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63386306/

相关文章:

c# - 为什么 CLR ThreadPool 工作线程使用 LIFO 顺序处理来自本地队列的任务?

c# - 使用 c# 对每个 utf-8 字符进行百分比编码

xcode - 存档验证错误 : Your Application Bundle must install to/Applications

android - 是否有任何修复 Android Studio 在 Macbook Pro 中不断断开测试设备的问题?

c# - docker : c# how to run selenium via webapi

c# - ConfigurationManager 是否与 ASP.NET Core 的 appsettings.json 一起工作?

c# - Task.Factory.StartNew 抛出异常

c# - WCF SSL 连接配置?

python - pip install MySQL-python 出错

c# - .Net 正则表达式处理中 "$"限定符的潜在不当行为