-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specifying both -f ... and -r ... to dotnet build fails to restore if multiple frameworks are present in the project file #21877
Comments
I found that So you can workaround by doing something like:
|
Same thing happens with |
IMO this is a critical scenario to fix. It is going to block / trip-up any developer who is trying to publish an iOS app.
Fails saying that you need to specify a RuntimeIdentifier. So then you do that:
And that fails with this error: Now developers are stuck, and they have no idea what to do. @marcpopMSFT @dsplaisted - is there anything we can do here? |
I think this is similar to this item: #19487 (comment) Basically, TF specified on command line is not passed to the restore operation if it's not in the TargetFrameworks property of the project file. @dsplaisted we previously discussed options and should bring that up again. |
Possible solution: If the |
Another developer has run into this issue: dotnet/runtime#65747. I believe this is going to be hit by any Maui developer. Any chance this can get looked into for the Maui release? Is there a better command line people should be passing instead of saying |
I ran into thiswhen trying to set up an iOS Build Pipeline in Azure DevOps for my app. I was following the instructions found here and then experienced exactly these issues... is there at least a work around? |
@Mephisztoe I think you should be able to run |
Tried that and didn't work. Then it says: I did run a restore task before and my csproj of course includes this RID. |
Does |
I believe it creates the .ipa file, which build doesn’t. |
Correct, but you can do that with build too:
which is ultimately what publish does for iOS. |
build instead of publish seems to work, btw. Thank's for this hint! |
@nkolev @dotnet/nuget-team I'm not sure how to fix this, I think we need to have a discussion with the NuGet team. I thought that the issue had to do with the fact that we weren't forwarding the |
I was trying to publish an ios-arm64 app and was able to work around this by adding an ios-arm64 |
@rolfbjarne I don't. Neither the tag PlatformTarget nor the content x64. |
That's strange. Can you get a binlog (build with the /bl flag: |
Meanwhile I figured that when I change
to
It starts compiling. But then I get stuck at "code signing key not found in keychain", which I am assuming is not related to the RuntimeIdentifier issue. I've documented the whole process also here: |
@rolfbjarne I created a brand new maui project from the template, and it doesn't have this issue. |
The If you're building from the command line, you should be able to just delete this file.
Correct, you need to configure code signing. You can find more info here: https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/ |
I have exactly the same problem with
Just like everyone else: <TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks>
<BuildIpa>False</BuildIpa>
<Configurations>Debug;Release;ARM64</Configurations>
<Platforms>AnyCPU;ARM64</Platforms>
<PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Release'">
<RuntimeIdentifiers>ios-arm64</RuntimeIdentifiers>
<CodesignKey>iPhone Distribution: xxx xxx (xxx)</CodesignKey>
<CodesignProvision>xxx</CodesignProvision>
<ArchiveOnBuild>true</ArchiveOnBuild>
<TcpPort>58181</TcpPort>
</PropertyGroup> And build with: In the MS docs it sounds so simple to build using a macos host but in reality everything is just broken and fails with errors a normal user is not able to understand. Requires lots of workarounds and in the end it still doesn't work. |
@Symbai I went through a myriad of errors as well. Now I got it to work: https://stackoverflow.com/a/72511005/5909367 Maybe it helps you too. In short, I guess this should be changed in your example: (Singular) and then |
Your original error is completely different one and your solution unfortunately that only generates a new error for me:
So
|
@Symbai Sorry to hear, that it doesn't work for you. So if I understand you correctly, you have now the same error as I had Xamarin.Shared.Sdk.targets(366,3) MessagingRemoteException, AggregateException and NotImplementedException but if you apply the solution that worked for me you get another error? Today I had a new error popping up and I could solve it by deleting these folders, bin, obj and .vs |
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. |
I got this working by building with the solution then use publish command from the main project directory. |
Considering IDE support is not yet available (and won't be for quite some time on macOS) this is an incredibly frustrating issue for developers working on cross-platform projects. @dsplaisted can you assign someone (else, since @gkulin unassigned herself) on the issue. Thanks! |
In the end we (xamarin/xamarin-macios) decided to remove the error to make things easier. However, even though this works sometimes, when it fails, it fails in really confusing ways: see xamarin/xamarin-macios#16401, where restoring an android project fails with an error about a linux nuget package, but only if the macOS target framework is present in the project file... Repro: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-macos</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>
</Project> Command: $ dotnet build -f net6.0-android -c Release -p:RuntimeIdentifier=android-x64
MSBuild version 17.4.0-preview-22465-02+02b334e3a for .NET
Determining projects to restore...
/Users/rolf/test/dotnet/issue-16401-a/testapp/testapp.Mobile/testapp.Mobile.csproj : error NU1102: Unable to find package Microsoft.NETCore.App.Runtime.linux-bionic-x64 with version (= 6.0.10)
/Users/rolf/test/dotnet/issue-16401-a/testapp/testapp.Mobile/testapp.Mobile.csproj : error NU1102: - Found 5 version(s) in nuget.org [ Nearest version: 7.0.0-preview.5.22301.12 ]
/Users/rolf/test/dotnet/issue-16401-a/testapp/testapp.Mobile/testapp.Mobile.csproj : error NU1102: - Found 0 version(s) in /usr/local/share/dotnet/library-packs
Failed to restore /Users/rolf/test/dotnet/issue-16401-a/testapp/testapp.Mobile/testapp.Mobile.csproj (in 109 ms). Incidentally you get the exact same error if restoring the macos target framework with the android runtime identifier: $ dotnet build -f net6.0-macos -c Release -p:RuntimeIdentifier=android-x64
MSBuild version 17.4.0-preview-22465-02+02b334e3a for .NET
Determining projects to restore...
/Users/rolf/test/dotnet/issue-16401-a/testapp/testapp.Mobile/testapp.Mobile.csproj : error NU1102: Unable to find package Microsoft.NETCore.App.Runtime.linux-bionic-x64 with version (= 6.0.10)
/Users/rolf/test/dotnet/issue-16401-a/testapp/testapp.Mobile/testapp.Mobile.csproj : error NU1102: - Found 5 version(s) in nuget.org [ Nearest version: 7.0.0-preview.5.22301.12 ]
/Users/rolf/test/dotnet/issue-16401-a/testapp/testapp.Mobile/testapp.Mobile.csproj : error NU1102: - Found 0 version(s) in /usr/local/share/dotnet/library-packs
Failed to restore /Users/rolf/test/dotnet/issue-16401-a/testapp/testapp.Mobile/testapp.Mobile.csproj (in 109 ms). which makes sense to fail (although the error message is more confusing than helpful). |
Hi, Is there an update on this by any chance? It affects quite a few of our customers and we'd love to know if there's anything we can do to help fix this Thank you!. |
Any update on this? This is a big issue. |
I fixed it by deleting the XXX.csproj.user which was really strange. |
Describe the bug
Repro:
The problem is that it's trying to restore the
net6.0-maccatalyst
framework from the project file using theios-arm64
RuntimeIdentifier, which fails, becauseios-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
The text was updated successfully, but these errors were encountered: