dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.87k stars 1.69k forks source link

project.assets.json contains invalid targets #22780

Open breyed opened 1 month ago

breyed commented 1 month ago

Description

The project.assets.json generated from the maui template contains a target for an Android app running on an iOS simulator: net8.0-android34.0/iossimulator-arm64. Other nonsensical targets include net8.0-ios17.2/android-arm and net8.0-maccatalyst17.2/android-x86.

I noticed this behavior while trying to debug the following error in a production project (don’t know whether it’s related):

Assets file '[project]/obj/project.assets.json' doesn't have a target for 'net8.0-maccatalyst/maccatalyst-arm64'. Ensure that restore has run and that you have included 'net8.0-maccatalyst' in the TargetFrameworks for your project. You may also need to include 'maccatalyst-arm64' in your project's RuntimeIdentifiers.

Steps to Reproduce

dotnet new maui
dotnet build

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

This behavior is not necessarily a problem. However, it might indicate an underlying problem that does cause symptoms.

Relevant log output

No response

github-actions[bot] commented 1 month ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

ninachen03 commented 1 month ago

I cannot repro this issue on (8.0.60 & 8.0.40) I tried the steps in the screenshots, and made different attempts. Scenario 1: Include all frameworks in VS and start the iOS simulator or Android Emulator. Scenario 2: Remove other frameworks in VS and keep iOS and Android. When starting the iOS simulator or Android Emulator, it still works. image

breyed commented 1 month ago

I confirmed that it’s still present on the latest 8.0.40.

➜  sudo dotnet workload update
➜  dotnet workload list

Installed Workload Id      Manifest Version       Installation Source
---------------------------------------------------------------------
maui-ios                   8.0.40/8.0.100         SDK 8.0.300        
maui-android               8.0.40/8.0.100         SDK 8.0.300        
ios                        17.2.8053/8.0.100      SDK 8.0.300        
maui                       8.0.40/8.0.100         SDK 8.0.300        
android                    34.0.113/8.0.100       SDK 8.0.300    

➜  dotnet new maui
➜  dotnet build

obj/project.assets.json contains the following reference to an iOS simulator on Android:

    "net8.0-android34.0/iossimulator-arm64": {
      "GoogleGson/2.10.1.4": {
        "type": "package",
        "compile": {
          "lib/net6.0-android31.0/GoogleGson.dll": {
            "related": ".aar;.xml"
          }
        },
        "runtime": {
          "lib/net6.0-android31.0/GoogleGson.dll": {
            "related": ".aar;.xml"
          }
        }
      },