PublishAotClang 1.0.5

dotnet add package PublishAotClang --version 1.0.5
                    
NuGet\Install-Package PublishAotClang -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PublishAotClang" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PublishAotClang" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="PublishAotClang" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PublishAotClang --version 1.0.5
                    
#r "nuget: PublishAotClang, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PublishAotClang@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PublishAotClang&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=PublishAotClang&version=1.0.5
                    
Install as a Cake Tool

PublishAotClang

这是一个由 Zig 包装成 Clang 工具链环境的 NuGet 包,用于在 Windows 上辅助 PublishAot 交叉编译到多个 linux RID,本项目源于 MichalStrehovsky/PublishAotCross。

新特性

工作项 说明
内置 zig 工具链 引用 Vezel.Zig.Toolsets,Windows 环境下无需单独安装 zig
内置 objcopy 工具 默认支持 Native AOT 的符号裁剪(strip),减少最终二进制体积
内置 libz 静态库 由 zig build zlib-1.3.2 得到,弥补.NET 8.0 AOT发布时未自带 libz 的问题
支持 glibc 版本指定 例如 <GLibcVersion>2.17</GLibcVersion>,.NET 10 项目也可运行于 CentOS 7 等老系统
重写 clang 包装工具 C# 重写,严格处理 clang 参数,增加移除 -Wl,--export-dynamic,避免不必要的全局符号导出
增加 ar 包装工具 C# 编写,支持 <NativeLib>Static</NativeLib> 的静态库项目进行 AOT 发布

如何使用

  1. 在 Native AOT 的项目中,添加对此 NuGet 包的引用。

  2. 在 Windows 机器上,可以额外 AOT 发布到以下 RID:

  • dotnet publish -r linux-x64
  • dotnet publish -r linux-arm64
  • dotnet publish -r linux-arm (.NET 9+)
  • dotnet publish -r linux-musl-x64
  • dotnet publish -r linux-musl-arm64
  • dotnet publish -r linux-musl-arm (.NET 9+)
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 456 6/27/2026
1.0.4 231 6/25/2026
1.0.3 260 6/8/2026
1.0.2 255 6/8/2026
1.0.1 243 6/8/2026
1.0.0 250 6/7/2026