The "--use-current-runtime" option doesn't work correctly in Arm-based musl system (Alpine)
See original GitHub issueThe --use-current-runtime
option should make use of the current system’s RID. This is not working currently when that system is on the Arm architecture and musl-based. I specifically used Alpine. Not sure if it’s all musl systems or just specific to Alpine since Alpine has its own RID. It’s essentially treating it as a non-musl-based system. In other words, it’s deriving the RID as linux-arm64
instead of linux-musl-arm64
. What’s interesting is that this only occurs for Arm64/Arm32 but not x64.
This can be shown in two ways using the dotnet restore
and dotnet publish
commands.
Repro steps
- Install .NET 7 RC2 SDK
- Verify RID by running
dotnet --info
:
.NET SDK:
Version: 7.0.100-rc.2.22477.23
Commit: 0a5360315a
Runtime Environment:
OS Name: alpine
OS Version: 3.16
OS Platform: Linux
RID: alpine.3.16-arm64
Base Path: /usr/share/dotnet/sdk/7.0.100-rc.2.22477.23/
Host:
Version: 7.0.0-rc.2.22472.3
Architecture: arm64
Commit: 550605cc93
.NET SDKs installed:
7.0.100-rc.2.22477.23 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.0-rc.2.22476.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.0-rc.2.22472.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
- Create a simple console app:
dotnet new console
- Restore the project:
dotnet restore --use-current-runtime -v normal
Notice in the output that package names are not specific to musl when they should be. For example, linux-arm64
should be linux-musl-arm64
in this output:
GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.runtime.linux-arm64/7.0.0-rc.2.22472.3/microsoft.netcore.app.runtime.linux-arm64.7.0.0-rc.2.22472.3.nupkg
- Restore again, this time explicitly specifying the RID:
dotnet restore -r linux-musl-arm64
- Now attempt to publish using the
--use-current-runtime
option:dotnet publish -c Release -o /app --use-current-runtime --no-restore
And you get this error because it’s trying to use linux-arm64
instead of linux-musl-arm64
:
/usr/share/dotnet/sdk/7.0.100-rc.2.22477.23/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1047: Assets file '/source/obj/project.assets.json' doesn't have a target for 'net7.0/linux-arm64'. Ensure that restore has run and that you have included 'net7.0' in the TargetFrameworks for your project. You may also need to include 'linux-arm64' in your project's RuntimeIdentifiers. [/source/aspnetapp.csproj]
If you just use --use-current-runtime
for all these steps and ignore the fact it’s not doing the right stuff, the app won’t run because it’s not using the correct bits for the system it’s running on. You end up getting this fun error when attempting to run the app:
standard_init_linux.go:228: exec user process caused: no such file or directory
Issue Analytics
- State:
- Created a year ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
I am actually using --use-current-runtime on musl arm64 for a while with net6.0 earliest RTM in a build machine. This regression was introduced in #22373 which I noticed a few weeks ago https://github.com/dotnet/sdk/pull/22373#discussion_r985007320 when testing upgrades with 7.0.0-rc2. We should backport the regression fix to 6.x as well.
We have definitely run out of time for GA. But this could be fixed in 7.0.1