Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET Library for Native Apps

dotnet AOT support is now out, this project will be archived as it is now officially suported

Steps from scratch

  • Create a new project
    dotnet new classlib -o DotNetLib
  • add NativeAOT support by creating a nuget config
    cd DotNetLib
    dotnet new nugetconfig
  • Add the following to the nuget.config file:
    <add key="dotnet-experimental" value="https://pkgs.dev.azure.com/dnceng/public/  _packaging/dotnet-experimental/nuget/v3/index.json" />
  • add a reference to the compiler
    dotnet add package Microsoft.DotNet.ILCompiler -v 7.0.0-*
  • then you can publish the dll like this
    dotnet publish /p:NativeLib=Shared /p:SelfContained=true -r <RID> -c <Configuration>

Cpp steps

  • make and build the native executable
    meson builddir
    meson compile -C builddir
  • put the library in the executable generated by meson (buiddir/cpp)
  • run it
    ./builddir/bin/<executable>

About

Example of how to build a .NET native library for another programs

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages