DotNET: Difference between revisions

From NixOS Wiki
imported>Milahu
add example build file
imported>Milahu
add link to buildDotnetPackage implementation
Line 60: Line 60:
* [https://ryantm.github.io/nixpkgs/languages-frameworks/dotnet/ dotnet in the nixpkgs manual]
* [https://ryantm.github.io/nixpkgs/languages-frameworks/dotnet/ dotnet in the nixpkgs manual]
* [https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/dotnet-packages.nix nixpkgs/pkgs/top-level/dotnet-packages.nix] → look for "SOURCE PACKAGES"
* [https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/dotnet-packages.nix nixpkgs/pkgs/top-level/dotnet-packages.nix] → look for "SOURCE PACKAGES"
* [https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/dotnet/build-dotnet-package/default.nix buildDotnetPackage implementation]
* [https://grep.app/search?q=buildDotnetPackage&filter%5Brepo%5D%5B0%5D=NixOS/nixpkgs&filter%5Blang%5D%5B0%5D=Nix&filter%5Bpath%5D%5B0%5D=pkgs/ buildDotnetPackage references in nixpkgs]
* [https://grep.app/search?q=buildDotnetPackage&filter%5Brepo%5D%5B0%5D=NixOS/nixpkgs&filter%5Blang%5D%5B0%5D=Nix&filter%5Bpath%5D%5B0%5D=pkgs/ buildDotnetPackage references in nixpkgs]
* https://en.wikipedia.org/wiki/.NET_Framework
* https://en.wikipedia.org/wiki/.NET_Framework
** https://en.wikipedia.org/wiki/List_of_CLI_languages: C#, [[Fsharp|F#]], Visual Basic, ...
** https://en.wikipedia.org/wiki/List_of_CLI_languages: C#, [[Fsharp|F#]], Visual Basic, ...
** https://en.wikipedia.org/wiki/Mono_(software) is the open source implementation of the DotNET compiler and runtime
** https://en.wikipedia.org/wiki/Mono_(software) is the open source implementation of the DotNET compiler and runtime

Revision as of 15:05, 1 March 2022

dotnet packages can be built with buildDotnetPackage

example build file:

/*
some_program/default.nix
nix-build -E 'with import <nixpkgs> { }; callPackage ./default.nix { }'
*/

{ lib
, stdenv
, fetchFromGitHub
, buildDotnetPackage
, dotnetPackages
, pkg-config
}:

buildDotnetPackage rec {
  pname = "some_program";
  baseName = pname; # workaround for "called without baseName"
  version = "some_version";
  src = fetchFromGitHub {
    owner = "some_owner";
    repo = pname;
    rev = "v${version}";
    sha256 = ""; # todo
  };
  projectFile = ["path/to/some_project.csproj"];
  propagatedBuildInputs = [
  ];
  buildInputs = [
    # unit tests
    dotnetPackages.NUnit
    dotnetPackages.NUnitRunners
  ];
  nativeBuildInputs = [
    pkg-config
  ];
  meta = with lib; {
    homepage = "some_homepage";
    description = "some_description";
    license = licenses.mit;
  };
}

XML namespace error

The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.

TODO

See also