JaneySprings / DotNet.Meteor

A VSCode extension that can run and debug .NET apps (Xamarin, MAUI, Avalonia)
https://marketplace.visualstudio.com/items?itemName=nromanov.dotnet-meteor
MIT License
269 stars 10 forks source link

Failed to run MAUI- IOS on VSCode for Mac #70

Closed msIFS closed 1 year ago

msIFS commented 1 year ago

Description: I am encountering an issue when trying to build and run my MAUI application using Visual Studio Code (VSCode) for Mac. The application builds successfully in Visual Studio for Mac but fails when using VSCode. I have provided the relevant configuration and error details below for your reference.

Configuration:

Here is my launch.json configuration file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Meteor Debugger",
            "type": "dotnet-meteor.debugger",
            "request": "launch",
            "preLaunchTask": "dotnet-meteor: Build"
        }
    ]
}

Build Command:

The generated build command for the project is as follows:

dotnet build "[PROJECT_LOCATION].csproj" -p:Configuration=Debug -p:TargetFramework=net7.0-ios -p:RuntimeIdentifier=**iossimulator-arm64** 

Errors Encountered:

  1. When attempting to run the application from VSCode using iossimulator-arm64, the following error occurs:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.7099/targets/Xamarin.Shared.Sdk.targets(1274,3): error : ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/[USERNAME]/.nuget/packages/foxit.sdk.dotnet.ios/9.0.0
  1. When trying to build using iossimulator-x64, the application builds successfully but cannot be run, resulting in the following error:
Failed to launch the simulator: Could not find file "/bin/Debug/net7.0-ios/iossimulator-arm64/TEST.MAUI.app/TEST.MAUI"
error MT1008: Failed to launch the simulator: Could not find file "/TEST.MAUI/bin/Debug/net7.0-ios/iossimulator-arm64/TEST.MAUI.app/TEST.MAUI"

Additional Information:

The application builds and runs without issues in Visual Studio for Mac.

Expected Behavior:

I expect the MAUI application to build and run successfully using Visual Studio Code on macOS, similar to the behavior in Visual Studio for Mac.

Environment:

macOS M1 Visual Studio Code .NET MAUI Thank you for your assistance in resolving this issue.

JaneySprings commented 1 year ago

Hello! I think that your application can't be launched on iossimulator-arm64. Can you check the behavior with the following workaround?

https://github.com/JaneySprings/DotNet.Meteor/pull/53#issuecomment-1511875479

msIFS commented 1 year ago

@JaneySprings Thanks a lot for you fast response and the provided solution you mentioned works perfectly :)