iot: dotnet publish / run for linux-arm fails with NetCore5 targets in preview 5+

Describe the bug

Running dotnet publish for a project with target netcore5 fails with the current runtime

Global.json at the time of this writting:

{
  "tools": {
    "dotnet": "5.0.100-preview.5.20251.2",
    "runtimes": {
      "dotnet/x64": [
        "2.1.11"
      ]
    }
  },
  "sdk": {
    "version": "5.0.100-preview.5.20251.2"
  },
  "msbuild-sdks": {
    "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20261.9",
    "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20261.9"
  }
}

Steps to reproduce

On the desktop (Windows) run:

cd projects\iot
build
# passes as expected
cd src\devices\Ads1115\samples
dotnet publish Ads1115.Samples.csproj -r linux-arm -c debug --self-contained false
# passes as well - all fine (the path \src\devices\Ads1115\samples\bin\Debug\netcoreapp2.1\linux-arm\publish now contains binaries ready to run on the pi)

# now change in Ads1115.Samples.csproj the <TargetFramework> entry to <TargetFramework>netcoreapp5.0</TargetFramework>
dotnet publish Ads1115.Samples.csproj -r linux-arm -c debug --self-contained false

An error is now reported:

C:\projects\iot2\src\devices\Ads1115\samples>dotnet publish Ads1115.Samples.csproj -r linux-arm -c debug --self-contained false
Microsoft (R)-Build-Engine, Version 16.7.0-preview-20229-03+2cee6d020 für .NET
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

  Wiederherzustellende Projekte werden ermittelt...
C:\projects\iot2\src\devices\Ads1115\samples\Ads1115.Samples.csproj : error NU1102: Das Paket "Microsoft.NETCore.App.Host.linux-arm" der Version (= 5.0.0-preview.5.20230.9) wurde nicht gefunden.
C:\projects\iot2\src\devices\Ads1115\samples\Ads1115.Samples.csproj : error NU1102:   - 2034 Version(en) gefunden in "https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" [ Nächste Version: 5.0.0-preview.5.20224.13 ]
C:\projects\iot2\src\devices\Ads1115\samples\Ads1115.Samples.csproj : error NU1102:   - 22 Version(en) gefunden in "nuget.org" [ Nächste Version: 5.0.0-preview.4.20251.6 ]
C:\projects\iot2\src\devices\Ads1115\samples\Ads1115.Samples.csproj : error NU1102:   - 0 Version(en) gefunden in https://dotnet.myget.org/F/dotnet-core/api/v3/index.json.
C:\projects\iot2\src\devices\Ads1115\samples\Ads1115.Samples.csproj : error NU1102:   - 0 Version(en) gefunden in https://dotnetfeed.blob.core.windows.net/dotnet-iot/index.json.
C:\projects\iot2\src\devices\Ads1115\samples\Ads1115.Samples.csproj : error NU1102:   - 0 Version(en) gefunden in https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json.
  Fehler beim Wiederherstellen von "C:\projects\iot2\src\devices\Ads1115\samples\Ads1115.Samples.csproj" (in "1.11 sec").
  2 von 3 Projekten sind für die Wiederherstellung auf dem neuesten Stand.

Expected behavior

Build passes

Actual behavior

See above. It looks a bit as if the SDK build that’s currently referenced is incomplete. The problem does not happen if going back to the “official” beta version 5.0.100-preview.4.20258.7

Versions used SDK: 5.0.100-preview.5.20251.2 [C:\Program Files\dotnet\sdk] Runtime: Microsoft.NETCore.App 5.0.0-preview.5.20230.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Edit See below: The problem got even worse with previews 6 and 7. I can’t get them to work at all on the Raspi when targetting NetCore 5.0.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 25 (21 by maintainers)

Most upvoted comments

Sure, I have the changes ready since they are very simple but we are currently blocked on commiting them( check #1091 for more info). Basically the change we need to do is to removed the winmd references from the project as well as the dependency to package System.Runtime.WindowsRuntime, and instead add a package dependency to Microsoft.Windows.SDK.NET. That’s it, that should make it work, except that we can’t make that change yet as there is a bug on that SDK package because it has assemblies that are not strong-named signed, and because our assembly is then we won’t be able to compile. I have pinged the team that manages that package so they are aware we are broken and will work on fixing it so that we are unblocked.