Skip to content

dotnet restore inconsistencies across platforms #24338

Open
@winterqt

Description

@winterqt

I'm a maintainer of Nixpkgs, the package repository for the Nix package manager. One of our explicit requirements is complete reproducibility, so we employ sandboxes and other restrictions to build packages. Our .NET packages currently do three things to solve the problem of remote dependencies:

  1. Create a list of packages needed, using dotnet restore and a script to pull metadata. This results in a file that looks like this
  2. Build a local source from those packages
  3. Use it when running dotnet restore (in an airgapped sandbox)

This has, for the most part, worked great. However, there's an issue that I discovered that makes what we currently do pretty fragile.

(I should note that if you look at our current dotnet restore invocations, we don't explicitly specify a RID to build for, which will clearly cause issues. I'm working to fix this, and everything that I've described below is in the context of explicitly specifying one.)

This root cause is how we use dotnet restore to get the list of packages, and how this interacts with bundled app hosts. For example, if I run a restore for linux-arm64 on linux-arm64, it produces a packages directory that does not include Microsoft.NETCore.App.Host.linux-arm64. Therefore, if the package list is built on a linux-arm64 machine, and then that list is used to try to compile a linux-arm64 build from a non-linux-arm64 system, it will fail. If the list is built on another system, this issue does not occur, but this is obviously not ideal.

A workaround suggested to me was to set NetCoreTargetingPackRoot to an invalid path during the restore, which would forcibly download the required app host.

Is this a workaround that can be utilized, or is there a better way to do our dependency management as a whole?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions