BeatSaberModManager icon indicating copy to clipboard operation
BeatSaberModManager copied to clipboard

Build error: You must either specify a RuntimeIdentifier or set PublishSingleFile to false.

Open Atemu opened this issue 3 years ago • 1 comments

Hi there, I packaged BSMM for Nixpkgs but I'm running into an issue I need to patch around which I'd rather not:

Executing dotnetInstallHook
MSBuild version 17.3.1+2badb37d1 for .NET
  IPA-lib -> /nix/store/hsx50dc5yly2bqinqcdr9sz6xs9zfawc-BeatSaberModManager-0.0.2/lib/BeatSaberModManager/
/nix/store/a5x48hb982y79kkh39n8wh16b62vi1iz-dotnet-sdk-6.0.401/sdk/6.0.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(102,5): error NETSDK1097: It is not supported to publish an application to a single-file without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set PublishSingleFile to false. [/build/source/BeatSaberModManager/BeatSaberModManager.csproj]

Do you know what's up with that?

My patch consists of adding the platform-specific RuntimeIdentifier into the build file but that feels dirty.

https://github.com/NixOS/nixpkgs/blob/4d6a7480991970801c0d195eebac90180026367b/pkgs/games/BeatSaberModManager/default.nix#L31-L36
https://github.com/NixOS/nixpkgs/blob/4d6a7480991970801c0d195eebac90180026367b/pkgs/games/BeatSaberModManager/add-runtime-identifier.patch#

Atemu avatar Nov 05 '22 12:11 Atemu

You can build the project with additional arguments, see the actions workflow. I don't know much about NixOS' packaging, but the command you need is dotnet publish -c Release -r linux-x64 --self-contained -p:PublishTrimmed=true for self-contained build (without .NET runtime dependency), and dotnet publish -c Release -r linux-x64 --no-self-contained for a framework-dependent build.

affederaffe avatar Nov 05 '22 12:11 affederaffe