Specifying both -f ... and -r ... to dotnet build fails to restore if multiple frameworks are present in the project file
See original GitHub issueDescribe the bug
Repro:
$ dotnet new maui
$ dotnet build -f:net6.0-ios -r ios-arm64
Microsoft (R) Build Engine version 17.0.0-preview-21477-04+3a1e456fe for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
/usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk/15.0.101-preview.10.54/targets/Xamarin.Shared.Sdk.targets(1138,3): error : The RuntimeIdentifier 'ios-arm64' is invalid. [/Users/rolf/test/dotnet/maui/maui.csproj]
The problem is that it’s trying to restore the net6.0-maccatalyst
framework from the project file using the ios-arm64
RuntimeIdentifier, which fails, because ios-arm64
is not a valid RuntimeIdentifier for Mac Catalyst.
It seems that the implicit restore by “dotnet build” does not take into account the specified -f value (or takes into account the -r value when it shouldn’t).
Binlog: msbuild.binlog.zip
Further technical details
dotnet --info
$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.100-rtm.21477.21
Commit: 690faf288e
Runtime Environment:
OS Name: Mac OS X
OS Version: 11.6
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.100-rtm.21477.21/
Host (useful for support):
Version: 6.0.0-rtm.21477.8
Commit: a7e9f9fb23
.NET SDKs installed:
2.0.3 [/usr/local/share/dotnet/sdk]
2.1.504 [/usr/local/share/dotnet/sdk]
2.1.700 [/usr/local/share/dotnet/sdk]
2.1.810 [/usr/local/share/dotnet/sdk]
2.2.107 [/usr/local/share/dotnet/sdk]
2.2.203 [/usr/local/share/dotnet/sdk]
2.2.204 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
3.1.100 [/usr/local/share/dotnet/sdk]
3.1.200 [/usr/local/share/dotnet/sdk]
3.1.201 [/usr/local/share/dotnet/sdk]
3.1.402 [/usr/local/share/dotnet/sdk]
5.0.100-dev [/usr/local/share/dotnet/sdk]
5.0.100-preview.1.20155.7 [/usr/local/share/dotnet/sdk]
5.0.100-preview.3.20170.3 [/usr/local/share/dotnet/sdk]
5.0.100-preview.4.20212.3 [/usr/local/share/dotnet/sdk]
5.0.100-preview.4.20214.36 [/usr/local/share/dotnet/sdk]
5.0.100-preview.5.20223.3 [/usr/local/share/dotnet/sdk]
5.0.100-preview.5.20227.16 [/usr/local/share/dotnet/sdk]
5.0.100-preview.5.20256.10 [/usr/local/share/dotnet/sdk]
5.0.100-preview.5.20263.11 [/usr/local/share/dotnet/sdk]
5.0.100-preview.6.20265.2 [/usr/local/share/dotnet/sdk]
5.0.100-preview.6.20269.4 [/usr/local/share/dotnet/sdk]
5.0.100-preview.7.20307.3 [/usr/local/share/dotnet/sdk]
5.0.100-preview.7.20317.11 [/usr/local/share/dotnet/sdk]
5.0.100-preview.8.20359.11 [/usr/local/share/dotnet/sdk]
5.0.100-rc.1.20411.10 [/usr/local/share/dotnet/sdk]
5.0.100-rc.1.20414.5 [/usr/local/share/dotnet/sdk]
5.0.100-rc.1.20426.3 [/usr/local/share/dotnet/sdk]
5.0.100-rc.2.20459.1 [/usr/local/share/dotnet/sdk]
5.0.100-rc.2.20480.7 [/usr/local/share/dotnet/sdk]
5.0.100-rtm.20509.5 [/usr/local/share/dotnet/sdk]
5.0.102 [/usr/local/share/dotnet/sdk]
5.0.200 [/usr/local/share/dotnet/sdk]
5.0.202 [/usr/local/share/dotnet/sdk]
6.0.100-alpha.1.20554.10 [/usr/local/share/dotnet/sdk]
6.0.100-alpha.1.20559.4 [/usr/local/share/dotnet/sdk]
6.0.100-alpha.1.21060.3 [/usr/local/share/dotnet/sdk]
6.0.100-alpha.1.21062.17 [/usr/local/share/dotnet/sdk]
6.0.100-preview.1.21081.5 [/usr/local/share/dotnet/sdk]
6.0.100-preview.1.21103.13 [/usr/local/share/dotnet/sdk]
6.0.100-preview.2.21114.3 [/usr/local/share/dotnet/sdk]
6.0.100-preview.2.21153.28 [/usr/local/share/dotnet/sdk]
6.0.100-preview.2.21155.3 [/usr/local/share/dotnet/sdk]
6.0.100-preview.3.21202.5 [/usr/local/share/dotnet/sdk]
6.0.100-preview.4.21215.1 [/usr/local/share/dotnet/sdk]
6.0.100-preview.4.21218.6 [/usr/local/share/dotnet/sdk]
6.0.100-preview.4.21226.14 [/usr/local/share/dotnet/sdk]
6.0.100-preview.4.21255.9 [/usr/local/share/dotnet/sdk]
6.0.100-preview.5.21302.13 [/usr/local/share/dotnet/sdk]
6.0.100-preview.5.21303.17 [/usr/local/share/dotnet/sdk]
6.0.100-preview.5.21308.63 [/usr/local/share/dotnet/sdk]
6.0.100-preview.6.21280.2 [/usr/local/share/dotnet/sdk]
6.0.100-preview.6.21308.62 [/usr/local/share/dotnet/sdk]
6.0.100-preview.6.21309.26 [/usr/local/share/dotnet/sdk]
6.0.100-preview.6.21328.1 [/usr/local/share/dotnet/sdk]
6.0.100-preview.7.21362.12 [/usr/local/share/dotnet/sdk]
6.0.100-preview.7.21364.4 [/usr/local/share/dotnet/sdk]
6.0.100-rc.1.21405.1 [/usr/local/share/dotnet/sdk]
6.0.100-rc.1.21458.1 [/usr/local/share/dotnet/sdk]
6.0.100-rc.2.21420.30 [/usr/local/share/dotnet/sdk]
6.0.100-rtm.21477.21 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.22 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.22 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.1.20124.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.3.20170.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.3.20170.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.4.20211.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.4.20214.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.5.20223.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.5.20227.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.5.20255.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.6.20265.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.6.20269.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.7.20307.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.7.20311.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.8.20359.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.1.20405.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.1.20424.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.2.20458.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rtm.20508.30 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-alpha.1.20526.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-alpha.1.21059.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-alpha.1.21062.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.1.21078.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.1.21103.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.2.21112.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.2.21125.25 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.2.21154.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.4.21213.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.4.21222.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.4.21253.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.5.21217.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.5.21301.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.6.21277.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.6.21306.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.6.21325.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.7.21360.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.7.21363.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.1.21404.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rc.2.21419.24 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-rtm.21477.22 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.1.20120.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.3.20169.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.4.20210.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.4.20214.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.5.20223.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.5.20227.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.5.20253.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.6.20263.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.6.20264.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.7.20306.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.7.20317.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.8.20358.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.1.20404.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.1.20425.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.2.20454.25 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rtm.20508.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-alpha.1.20553.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-alpha.1.20557.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-alpha.1.21059.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-alpha.1.21061.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.7.21360.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.1.21403.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rc.2.21420.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-rtm.21477.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:35 (19 by maintainers)
Top Results From Across the Web
How to fix: Add a reference to ".NETFramework,Version=v4 ...
Add a reference to ".NETFramework,Version=v4.8" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.
Read more >dotnet restore command - .NET CLI
Learn how to restore dependencies and project-specific tools with the dotnet restore command.
Read more >dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies.
Read more >Troubleshoot .NET Framework targeting errors
Open Solution Explorer. · Select Show All Files. · Expand My Project (Visual Basic) or Properties (C#), and then edit the Resources.resx file...
Read more >NETSDK1045: The current .NET SDK does not support ...
Open the Solution Properties window (ctrl-click the solution in the Solution window and select Properties), select Build - General, and uncheck ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m sorry but all of this is just bullsh… from changing plural to singular, deleting this file, this folder, adding and removing it from your csproj. And all of it only changes the error message you get, without you having a clue on what’s going on. Trial and error until you succeed or until you notice you just wasted tons of hours. If you look at the official documentation on how to publish an iOS app, you see NONE of all of that is necessary. It says run this command and it should work. It does not. But it isn’t my or your job to figure out whats the problem and how to solve it. I’ve already wasted enough hours on this. I just copied the whole project on my macbook and successfully compiled it on the mac with just a single command and now I’m done. I thought that with how old Xamarin is these basic things would be kinda stable and very well tested, now I wish that I’d have chosen something different if it wasn’t too late for that.
Same thing happens with
dotnet publish
: https://github.com/xamarin/xamarin-macios/issues/14015