Android publish: error NETSDK1191: A runtime identifier for the property 'SelfContained' couldn't be inferred
See original GitHub issueDescription
After .Net 8 Preview 5 publishing Android App broke.
dotnet publish ./MauiApp1/MauiApp1.csproj -f net8.0-android -c Release
error NETSDK1191: A runtime identifier for the property ‘SelfContained’ couldn’t be inferred
A runtime Identifier cannot be speciified because Android publishes for several Processor Architectures android-arm64 android-arm for example.
Steps to Reproduce
-
Create new Maui Project select .Net 8.0 (Preview)
-
Execute on Command line
dotnet publish ./MauiApp1/MauiApp1.csproj -f net8.0-android -c Release
Link to public reproduction project repository
https://github.com/inforithmics/AndroidMauiPublish
Version with bug
8.0.0-preview.5.8529
Last version that worked well
8.0.0-preview.4.8333
Affected platforms
Android
Affected platform versions
Android
Did you find any workaround?
specifying android runtime:
dotnet publish -r android-arm64 ./MauiApp1/MauiApp1.csproj -f net8.0-android -c Release
but this builds only for android-arm64 in .Net 8
dotnet publish ./MauiApp1/MauiApp1.csproj -f net7.0-android -c Release
built in .Net 7 for the other platforms too (android-arm/android-arm64 for example)
Relevant log output
MSBuild version 17.7.0-preview-23281-03+4ce2ff1f8 for .NET
Determining projects to restore...
Restored C:\temp\MauiApp1\MauiApp1\MauiApp1.csproj (in 698 ms).
C:\Program Files\dotnet\sdk\8.0.100-preview.5.23303.2\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInf
erence.targets(212,5): error NETSDK1191: A runtime identifier for the property 'SelfContained' couldn't be inferred. Sp
ecify a rid explicitly. [C:\temp\MauiApp1\MauiApp1\MauiApp1.csproj::TargetFramework=net8.0-android]
Issue Analytics
- State:
- Created 3 months ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Related StackOverflow Question
For now, the workarounds are:
dotnet buildinstead<PublishSelfContained>false</PublishSelfContained>or<SelfContained>false</SelfContained>in your.csproj, the Android build forcesSelfContained=trueno matter what.There isn’t a non-self-contained Android app, as that would imply some kind of system-wide .NET package from Google Play, etc. that runs on Android. We don’t have such a thing.
Setting
<SelfContained>false</SelfContained>in the csproj worked - Thanks.