DotNET: Difference between revisions

imported>Aerphanas
added how to fix .net location not found
imported>WhiteBlackGoose
Added NativeAOT shell configuration (relevant since .NET 7).
Line 116: Line 116:


see also https://stackoverflow.com/questions/32254439/nuget-packages-are-missing
see also https://stackoverflow.com/questions/32254439/nuget-packages-are-missing
== NativeAOT ==
This is relevant for NixOS only.
[https://github.com/Mic92/nix-ld nix-ld] is needed:
<syntaxHighlight lang=nix>
{
  programs.nix-ld.enable = true;
}
</syntaxHighlight>
Now we will need a bunch of native dependencies. Here's an example of a shell:
<syntaxHighlight lang=nix>
with import <nixpkgs> {};
pkgs.mkShell rec {
  dotnetPkg =
    (with dotnetCorePackages; combinePackages [
      sdk_7_0
    ]);
  deps = [
    zlib
    zlib.dev
    openssl
    dotnetPkg
  ];
  NIX_LD_LIBRARY_PATH = lib.makeLibraryPath ([
    stdenv.cc.cc
  ] ++ deps);
  NIX_LD = lib.fileContents "${stdenv.cc}/nix-support/dynamic-linker";
  nativeBuildInputs = [
  ] ++ deps;
  shellHook = ''
    DOTNET_ROOT="${dotnetPkg}";
  '';
}
</syntaxHighlight>


== See also ==
== See also ==