Pack dotnet-sos/dotnet-debugger-extensions as AOT tool

Abierto
#5,851 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
csharp

Línea de trabajo

Comienza localizando el proyecto de empaquetado dotnet-sos/dotnet-debugger-extensions y su configuración existente de tool-package; el issue no nombra archivos del repositorio ni pruebas. Usa los comandos documentados dotnet pack y dotnet tool install para verificar paquetes separados de root y runtime, y confirma después con readelf que la herramienta instalada es Native AOT y se ejecuta en la plataforma actual.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

With .NET 10, we can now leverage the standard convention of separating the 'root package' from the 'runtime package' when building AOT tools.

This scalable model allows us to replace the current monolithic infrastructure and its hardcoded list of Microsoft-supported platforms. By adopting this approach, we can easily accommodate community-driven and emerging platforms.


Tutorial: Building a Native AOT Tool
$ echo 'using static System.Runtime.InteropServices.RuntimeInformation;
Console.WriteLine($"{OSDescription}\n{FrameworkDescription}");' | dotnet run -

Alpine Linux v3.23
.NET 10.0.8

$ dotnet new console -n myaottool
$ cd myaottool

Program.cs

using System;

Console.WriteLine("Hello from a Native AOT .NET Tool!");
Console.WriteLine($"Running on: {Environment.OSVersion}");

myaottool.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <PackAsTool>true</PackAsTool>
    <PublishAot>true</PublishAot>

    <ToolPackageRuntimeIdentifiers>
      <!-- Windows -->
      win-x64;win-x86;win-arm64;
      <!-- Linux -->
      linux-x64;linux-arm;linux-arm64;
      linux-musl-x64;linux-musl-arm;linux-musl-arm64;
      <!-- macOS -->
      osx-x64;osx-arm64;
      <!-- Current RID (for community/custom platforms) -->
      $(RuntimeIdentifier)
    </ToolPackageRuntimeIdentifiers>
  </PropertyGroup>

</Project>

The runtime tool is now a standalone package. Note that separate builds are required for each supported platform to generate the necessary runtime artifacts.

# Pack the root package
$ dotnet pack -c Release

# Pack the runtime-specific package (for the current platform)
$ dotnet pack -c Release --ucr

$ find . -name '*pkg'
./bin/Release/myaottool.linux-musl-arm64.1.0.0.nupkg
./bin/Release/myaottool.1.0.0.nupkg

We can now push this nupkg to nuget from each "official" machine. The community guys can just place their runtime pack to <sdk path>/library-packs in their builds.

test and verify locally (does it work, is it really AOT app etc.):

$ dotnet tool install --global --add-source bin/Release myaottool

$ myaottool 
Hello from a Native AOT .NET Tool!
Running on: Unix 6.12.76.0

$ readelf -p .comment $(realpath $(command -v myaottool))
String dump of section '.comment':
  [     0]  GCC: (Alpine 15.2.0) 15.2.0
  [    1c]  clang version 20.1.8
  [    31]  .NET: ilc 10.0.8-servicing.26229.119+94ea82652cdd4e0f8046b5bd5becbd11461482ca
Lenguaje dominante
C++
Estrellas
1.3k
Forks
407
Merge medio
21 h 5 min
PR fusionados (30 d)
78

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

  • Sin Dockerfile ni archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotnet/diagnostics

Todos los issues de dotnet/diagnostics

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.