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.83k stars 1.67k forks source link

IOS build failed with "You may also need to include 'iossimulator-x64' in your project's RuntimeIdentifiers" #23352

Open RagibNoor opened 6 days ago

RagibNoor commented 6 days ago

Description

i am unable to run my project on simulator getting following error

/usr/local/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(5,5): Error NETSDK1047: Assets file '/Users/ragib.noor/Repository/PMI_Service_Gateway/src/PMI.Service.Mobile.Maui/PMI.Service.Mobile.Maui.iOS/obj/project.assets.json' doesn't have a target for 'net8.0-ios/iossimulator-x64'. Ensure that restore has run and that you have included 'net8.0-ios' in the TargetFrameworks for your project. You may also need to include 'iossimulator-x64' in your project's RuntimeIdentifiers. (NETSDK1047) (PMI.Service.Mobile.Maui.iOS)

In my project i am targeting ios only in runtime , here is my project configuration

<PropertyGroup>
    <TargetFramework>net8.0-ios</TargetFramework>
    <SupportedOSPlatformVersion>14.0</SupportedOSPlatformVersion>
    <OutputType>Exe</OutputType>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <UseMaui>true</UseMaui>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
    <CreatePackage>false</CreatePackage>
    <BuildIpa>true</BuildIpa>
    <IpaMetadata>info.plist</IpaMetadata>
    <IpaPackageName>****</IpaPackageName>
    <CodesignKey>*****</CodesignKey>
    <CodesignProvision>****</CodesignProvision>
    <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
    <UseNativeHttpHandler>false</UseNativeHttpHandler>
    <MtouchExtraArgs>-v -v -v -v --dlsym:Microsoft.Win32.Registry.dll</MtouchExtraArgs>
    <MtouchLink>SdkOnly</MtouchLink>
    <OptimizePNGs>false</OptimizePNGs>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
    <CreatePackage>false</CreatePackage>
    <BuildIpa>true</BuildIpa>
    <IpaMetadata>info.plist</IpaMetadata>
    <CodesignProvision>******</CodesignProvision>
    <CodesignKey></CodesignKey>
    <IpaPackageName></IpaPackageName>
    <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
    <MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
</PropertyGroup>

I have tried to clean my bin/obj folder restart ide multiple time still no luck .

here is MY VS details

Visual Studio Community 2022 for Mac
Version 17.6.12 (build 410)
Installation UUID: 77a4961a-16b0-4d71-867b-366b473d86b3

Runtime
.NET 7.0.3 (64-bit)
Architecture: Arm64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/8.0.302/Sdks
SDK Versions:
    8.0.302
    7.0.316
    6.0.422
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    8.0.6
    7.0.19
    6.0.30

Xamarin.Profiler
Version: 1.8.0.49
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode: 15.2 22503
Build: 15C500b

Xamarin.Mac
Version: 9.3.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:14:59-0400

Xamarin.iOS
Version: 16.4.0.23 Visual Studio Community
Hash: 9defd91b3
Branch: xcode14.3
Build date: 2023-10-23 16:15:00-0400

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2024-05-09 04:36:07 UTC

Xamarin.Android
Version: 13.2.2.0 (Visual Studio Community)
Commit: xamarin-android/d17-5/45b0e14
Android SDK: /Users/ragib.noor/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 34.0.3
SDK Build Tools Version: 32.0.0

Build Information: 
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite/3.40.1@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.16.1
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2024-05-09 04:36:12 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2024-05-09 04:36:12 UTC

Build Information
Release ID: 1706120410
Git revision: 2f8e0518dd80a933901821bac53f7398d4b61c0f
Build date: 2024-05-09 04:34:23+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 14.5.0
Darwin 23.5.0 Darwin Kernel Version 23.5.0
    Wed May  1 20:17:33 PDT 2024
    root:xnu-10063.121.3~5/RELEASE_ARM64_T6031 arm64
Screenshot 2024-06-29 at 2 13 52 AM

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 6 days 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.

kramer-e commented 3 days ago

There are many people running into this problem. The only workaround as far as I know is to delete the project.assets.json file from /obj/ and rebuild your project.

After some time it is broken again, does anyone know a fix by setting the correct runtime when building for a simulator?