Skip to content
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

nuget looking for (old, not mono) Microsoft.NETCore.App.Runtime.maccatalyst-arm64 #15664

Closed
spouliot opened this issue Aug 9, 2022 · 12 comments
Labels
bug If an issue is a bug or a pull request a bug fix iOS Issues affecting iOS need-attention An issue requires our attention/response
Milestone

Comments

@spouliot
Copy link
Contributor

spouliot commented Aug 9, 2022

This is semi-related to dotnet/sdk#21877 where a .csproj has several target frameworks.

<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst;net6.0-macos</TargetFrameworks>

This leads to the known issues :( but this one seems different.

The main project imports another file that contains

<TargetFramework>net6.0-macos</TargetFramework>
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier>

That's to avoid (some) of the issues with dotnet/sdk#21877

That works well to do a dotnet restore for macOS. However switching to MacCatalyst leads to nuget errors to retrieve the runtime package.

<TargetFramework>net6.0-maccatalyst</TargetFramework>
<RuntimeIdentifier>maccatalyst-arm64</RuntimeIdentifier>

Steps to Reproduce

  1. dotnet restore inside a project with multiple framework targets.
$ dotnet restore                                                                                                                              
  Determining projects to restore...
/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj : error NU1102: Unable to find package Microsoft.NETCore.App.Runtime.maccatalyst-arm64 with version (= 6.0.6)
/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj : error NU1102:   - Found 2 version(s) in nuget.org [ Nearest version: 6.0.0-preview.3.21201.4 ]
/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj : error NU1102:   - Found 0 version(s) in /usr/local/share/dotnet/library-packs
  Failed to restore /Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj (in 609 ms).
  • Microsoft.NETCore.App.Runtime.maccatalyst-arm64 does not exists (anymore)
  • Microsoft.NETCore.App.Runtime.Mono.maccatalyst-arm64 was its replacement.
  • Somehow, somewhere, something is still looking for the old/original name.
  • The error comes from nuget but I don't think it has the knowledge of the runtime filenames.

Expected Behavior

Successful restore.

$ dotnet restore                                                                                                                         Determining projects to restore...
  Restored /Users/poupou/git/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj (in 1.99 sec).

Actual Behavior

Nuget error NU1102.

Environment

Version information
$ dotnet --info    
.NET SDK (reflecting any global.json):
 Version:   6.0.301
 Commit:    43f9b18481

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  12.4
 OS Platform: Darwin
 RID:         osx.12-arm64
 Base Path:   /usr/local/share/dotnet/sdk/6.0.301/

Host (useful for support):
  Version: 6.0.6
  Commit:  7cca709db2

.NET SDKs installed:
  6.0.100 [/usr/local/share/dotnet/sdk]
  6.0.101 [/usr/local/share/dotnet/sdk]
  6.0.200 [/usr/local/share/dotnet/sdk]
  6.0.201 [/usr/local/share/dotnet/sdk]
  6.0.202 [/usr/local/share/dotnet/sdk]
  6.0.203 [/usr/local/share/dotnet/sdk]
  6.0.300 [/usr/local/share/dotnet/sdk]
  6.0.301 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Build Logs

Example Project (If Possible)

@spouliot
Copy link
Contributor Author

spouliot commented Aug 9, 2022

Also, when switching to iOS dotnet restore works just fine

<TargetFramework>net6.0-ios</TargetFramework>
<RuntimeIdentifier>iossimulator-arm64</RuntimeIdentifier>

@dalexsoto dalexsoto added bug If an issue is a bug or a pull request a bug fix iOS Issues affecting iOS labels Aug 12, 2022
@dalexsoto dalexsoto added this to the .NET 7 milestone Aug 12, 2022
@dalexsoto
Copy link
Member

Thanks, we will have a look at it!

@spouliot
Copy link
Contributor Author

using maccatalyst-x64 seems to work

dotnet build -f net6.0-maccatalyst -r maccatalyst-x64 --no-restore                                                                     
MSBuild version 17.3.0+92e077650 for .NET
/usr/local/share/dotnet/sdk/6.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(1114,5): warning NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. [/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj]
  Detected signing identity:

    Bundle Id: com.companyname.changeme
    App Id: com.companyname.changeme
  DebugMyApp.Mobile -> /Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/DebugMyApp.Mobile.dll
  Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink

Build succeeded.

/usr/local/share/dotnet/sdk/6.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(1114,5): warning NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. [/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:20.96

but still no luck with maccatalyst-arm64

dotnet build -f net6.0-maccatalyst -r maccatalyst-arm64 --no-restore                                                                   MSBuild version 17.3.0+92e077650 for .NET
/usr/local/share/dotnet/sdk/6.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(1114,5): warning NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. [/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj]
  Detected signing identity:

    Bundle Id: com.companyname.changeme
    App Id: com.companyname.changeme
/usr/local/share/dotnet/sdk/6.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1047: Assets file '/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/obj/project.assets.json' doesn't have a target for 'net6.0-maccatalyst/maccatalyst-arm64'. Ensure that restore has run and that you have included 'net6.0-maccatalyst' in the TargetFrameworks for your project. You may also need to include 'maccatalyst-arm64' in your project's RuntimeIdentifiers. [/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj]

Build FAILED.

/usr/local/share/dotnet/sdk/6.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(1114,5): warning NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. [/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj]
/usr/local/share/dotnet/sdk/6.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1047: Assets file '/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/obj/project.assets.json' doesn't have a target for 'net6.0-maccatalyst/maccatalyst-arm64'. Ensure that restore has run and that you have included 'net6.0-maccatalyst' in the TargetFrameworks for your project. You may also need to include 'maccatalyst-arm64' in your project's RuntimeIdentifiers. [/Users/poupou/git/uno/uno-debug-test/DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj]
    1 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.15

It does not seems possible to have a project with multiple platforms that target MacCatalyst with arm64 :(

@rolfbjarne
Copy link
Member

This error:

error NETSDK1047: Assets file ...

occurs when a project hasn't been restored for the RID in question, and you're passing in --no-restore to dotnet build, so that makes sense.

@rolfbjarne
Copy link
Member

This csproj restores just fine for me:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFrameworks>net6.0-ios;net6.0-maccatalyst;net6.0-macos</TargetFrameworks>
		<RuntimeIdentifier>maccatalyst-arm64</RuntimeIdentifier>
	</PropertyGroup>
</Project>
$ dotnet restore
Determining projects to restore...
Restored MySimpleApp.csproj (in 212 ms).

Can you provide a test project?

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Aug 29, 2022
@ghost
Copy link

ghost commented Aug 29, 2022

Hi @spouliot. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@spouliot
Copy link
Contributor Author

@rolfbjarne yes, restore works - but you can't build a maccatalyst-arm64 binary of a default maui template.

dotnet build -f:net6.0-maccatalyst -r:maccatalyst-arm64                                                                                                                                     MSBuild version 17.3.0+92e077650 for .NET
  Determining projects to restore...
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/15.4.430/targets/Xamarin.Shared.Sdk.targets(1744,3): error : The RuntimeIdentifier 'maccatalyst-arm64' is invalid. [/Users/poupou/projects/maui/maui.csproj]

Since you're back to dotnet/sdk#21877 which mix SDK, like Microsoft.iOS.Sdk, and identifiers, like maccatalyst-arm64). The workaround is where the --no-restore is being used.

When I restore independently and build with --no-restore then I hit the above error.

How would you build the maccatalyst-arm64 binary of a default maui template from the command-line ?

@ghost ghost added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Aug 29, 2022
@rolfbjarne
Copy link
Member

This seems to work for me:

$ dotnet restore /p:RuntimeIdentifier=maccatalyst-arm64
$ dotnet build -f net6.0-maccatalyst /p:RuntimeIdentifier=maccatalyst-arm64 --no-restore *.csproj

@rolfbjarne rolfbjarne added need-info Waiting for more information before the bug can be investigated and removed need-attention An issue requires our attention/response labels Aug 31, 2022
@ghost
Copy link

ghost commented Aug 31, 2022

Hi @spouliot. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@spouliot
Copy link
Contributor Author

spouliot commented Sep 1, 2022

@rolfbjarne was your project based on the default MAUI template for all (at least multiple) platforms ?

$ dotnet restore /p:RuntimeIdentifier=maccatalyst-arm64                                                                                                                                                Determining projects to restore...
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/15.4.430/targets/Xamarin.Shared.Sdk.targets(1744,3): error : The RuntimeIdentifier 'maccatalyst-arm64' is invalid. [/Users/poupou/projects/maui/maui.csproj]

@ghost ghost added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Sep 1, 2022
@rolfbjarne
Copy link
Member

Try updating to 15.4.447: https://github.com/xamarin/xamarin-macios/releases/tag/dotnet-6.0.4xx-447, where we've done this: #15491

@spouliot
Copy link
Contributor Author

spouliot commented Sep 1, 2022

Thanks! Works for MAUI and likely on my original code (need to remove some workaround to try it). I thought I updated to 447 but I now remember the downloads were failing at the time and forgot to try updating again.

@spouliot spouliot closed this as completed Sep 1, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug If an issue is a bug or a pull request a bug fix iOS Issues affecting iOS need-attention An issue requires our attention/response
Projects
None yet
Development

No branches or pull requests

3 participants