Skip to content

Instantly share code, notes, and snippets.

@r-k-b
Last active July 21, 2020 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r-k-b/88708950271e21b6ee961439d18c6316 to your computer and use it in GitHub Desktop.
Save r-k-b/88708950271e21b6ee961439d18c6316 to your computer and use it in GitHub Desktop.
blocked on dotnet errors (nix, hippo)

this is as close as I've gotten to building Hippo in NixOS

Can't get past the errors:

MSB4242: The SDK resolver "Microsoft.DotNet.MSBuildSdkResolver" failed to run

and

warning NU1701: Package was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

and

[CS0012] The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

I thought it was related to the old 6.0 version of Mono in nixpkgs, but checking out this PR for 6.10 locally and pointing this shell.nix at it didn't help with the errors: NixOS/nixpkgs#93043

(mono --version did report 6.10 in the shell)


The project builds fine on Ubuntu and MacOS, so it's unlikely that some .csproj or other project file needs to be changed; more likely there's something that Nix isn't providing (the "resolver"?)


also the version of Rider from nixpkgs fails to start (java exception?), so instead I've been using:

nix run -f https://github.com/NixOS/nixpkgs/archive/b90dfdab83c196f479c2eb2209031585e7d961fc.tar.gz jetbrains.rider -c rider

Related Discourse post here


This sounds suspicious:

However, the netstandard.dll should IMO be referenced by default (by the msbuild/csc), just like mscorlib is.

That is done by our internal tooling by default. If this is not being done in your project, it means that we were not able to detect that the project depends on netstandard.dll facade, which might be the case when the netstandard dependent assembly is comming in as a transitive dependency and your project is using old tooling (like packages.config instead of PackageReference for example)


UPDATE 2020-07-21

Add the Nuget package Microsoft.NETFramework.ReferenceAssemblies 1.0.0 to the packages that are broken, and from the shell.nix remove mono and the export FrameworkPathOverride= bit.

Still not sure why it worked without that package on other Linux machines and not on NixOS... Was I not setting mono up correctly?

helpful stuff:

let pkgs = import <nixpkgs> { };
in pkgs.mkShell rec {
name = "webdev";
buildInputs = with pkgs; [
docker
docker-compose
#dotnet-netcore
#dotnet-sdk
dotnet-sdk_3
#dotnetCorePackages.netcore_3_0
dotnetCorePackages.netcore_3_1
#dotnetCorePackages.sdk_3_0
dotnetCorePackages.sdk_3_1
dotnetPackages.Nuget
#msbuild
#mono6
(callPackage
/home/rkb/projects/nixpkgs/pkgs/development/compilers/mono/6.nix {
Foundation = pkgs.Foundation;
libobjc = pkgs.libobjc;
python38 = pkgs.python38;
})
jetbrains.rider
];
# Fixes "The reference assemblies for .NETFramework,Version=v4.7.2 were not found"
shellHook = ''
export FrameworkPathOverride=${pkgs.mono}/lib/mono/4.7.2-api
'';
}
let
pkgs = import <nixpkgs> { };
dotnetCombined = with pkgs.dotnetCorePackages;
combinePackages [ sdk_3_1 netcore_3_1 ];
in pkgs.mkShell rec {
name = "webdev";
buildInputs = with pkgs; [
docker
docker-compose
dotnetPackages.Nuget
dotnetCombined
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment