
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
| 包 | 最新稳定版 | 最新预览版 |
|---|---|---|
| dotnet-execute | 
dotnet-exec 是一个无需项目文件即可执行C#程序的命令行工具,支持自定义入口点(非Main方法)。
无需dotnet环境即可执行的GitHub Action:
最新稳定版:
shdotnet tool update -g dotnet-execute
最新预览版:
shdotnet tool update -g dotnet-execute --prerelease
安装失败?尝试以下命令:
shdotnet tool update -g dotnet-execute --prerelease --add-source https://api.nuget.org/v3/index.json --ignore-failed-sources
使用Docker执行
shdocker run --rm weihanli/dotnet-exec:latest "1+1"
shdocker run --rm weihanli/dotnet-exec:latest "Guid.NewGuid()"
shdocker run --rm --pull=always weihanli/dotnet-exec:latest "ApplicationHelper.RuntimeInfo"
使用Podman执行
shpodman run --rm weihanli/dotnet-exec:latest "1+1"
shpodman run --rm weihanli/dotnet-exec:latest "Guid.NewGuid()"
shpodman run --rm --pull=always weihanli/dotnet-exec:latest "ApplicationHelper.RuntimeInfo"
完整镜像标签列表见 https://hub.docker.com/r/weihanli/dotnet-exec/tags
执行本地文件:
shdotnet-exec HttpPathJsonSample.cs
使用自定义入口点执行本地文件:
shdotnet-exec 'HttpPathJsonSample.cs' --entry MainTest
执行远程文件:
shdotnet-exec https://github.com/WeihanLi/SamplesInPractice/blob/master/net7Sample/Net7Sample/ArgumentExceptionSample.cs
执行原始代码:
shdotnet-exec 'Console.WriteLine(1+1);'
执行原始脚本:
shdotnet-exec '1 + 1'
shdotnet-exec 'Guid.NewGuid()'
使用自定义引用执行原始代码:
NuGet包引用:
shdotnet-exec 'CsvHelper.GetCsvText(new[]{1,2,3}).Dump();' -r "nuget: WeihanLi.Npoi,2.4.2" -u "WeihanLi.Npoi"
本地DLL引用:
shdotnet-exec 'CsvHelper.GetCsvText(new[]{1,2,3}).Dump();' -r "./out/WeihanLi.Npoi.dll" -u "WeihanLi.Npoi"
文件夹中的本地DLL引用:
shdotnet-exec 'CsvHelper.GetCsvText(new[]{1,2,3}).Dump();' -r "folder: ./out" -u "WeihanLi.Npoi"
本地项目引用:
shdotnet-exec 'CsvHelper.GetCsvText(new[]{1,2,3}).Dump();' -r "project: ./WeihanLi.Npoi.csproj" -u "WeihanLi.Npoi"
框架引用:
shdotnet-exec 'WebApplication.Create().Run();' --reference 'framework:web'
Web框架引用(简化选项):
shdotnet-exec 'WebApplication.Create().Run();' --web
使用自定义命名空间执行原始代码:
shdotnet-exec 'WriteLine(1+1);' --using "static System.Console"
使用自定义引用执行脚本:
shdotnet-exec 'CsvHelper.GetCsvText(new[]{1,2,3}).Dump()' -r "nuget:WeihanLi.Npoi,2.4.2" -u WeihanLi.Npoi
使用额外依赖执行:
shdotnet-exec 'typeof(LocalType).FullName.Dump();' --ad FileLocalType2.cs
shdotnet-exec 'typeof(LocalType).FullName.Dump();' --addition FileLocalType2.cs
从项目文件提取引用和命名空间执行:
shdotnet-exec 'typeof(LocalType).FullName.Dump();' --project ./Sample.csproj
使用预览功能执行文件:
shdotnet-exec RawStringLiteral.cs --preview
可将常用配置保存为配置文件以便复用。
列出已配置的文件:
shdotnet-exec profile ls
配置文件:
shdotnet-exec profile set web -r "nuget:WeihanLi.Web.Extensions" -u 'WeihanLi.Web.Extensions' --web --wide false
获取文件详情:
shdotnet-exec profile get web
删除不需要的文件:
shdotnet-exec profile rm web
使用特定配置文件执行:
shdotnet-exec 'WebApplication.Create().Chain(_=>_.MapRuntimeInfo()).Run();' --profile web --using 'WeihanLi.Extensions'
!image
使用特定配置文件执行并移除预设命名空间:
shdotnet-exec 'WebApplication.Create().Run();' --profile web --using '-WeihanLi.Extensions'
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务