-
Notifications
You must be signed in to change notification settings - Fork 14
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
[BUG] .NET MAUI extension always starts with the device target first available on the list no matter what the user selection is #250
Comments
Hi @egvijayanand ! If you try an Android emulator or physical does that work? I'm wondering if this is a WSA issue. When you launch a WSA app it looks just like a Windows app - if you build and deploy for Windows is the app the exact same? |
@maddymontaquila, have validated the build command that is running in the background. Building it for the Windows platform only ( Will try to connect a physical Android device and update the outcome. |
Here's the command from the VS Terminal (username alone removed to protect privacy): Executing task: dotnet build -t:Build -p:Configuration=Debug -f net8.0-windows10.0.19041.0 -r win10-x64 -p:WindowsPackageType=None -p:CustomAfterMicrosoftCSharpTargets="c:\Users<username>.vscode\extensions\ms-dotnettools.dotnet-maui-0.1.34-win32-x64\dist\resources\maui\MauiVSCodeWindows.targets" -p:_DeletePriConfigXml=True e:\MAUI\NET_8\Preview_6\MauiApp1\MauiApp1.csproj MSBuild version 17.7.0+5785ed5c2 for .NET Build succeeded. |
@maddymontaquila Have tried with a physical Android phone as the target device. But no change in the output. It always builds for the Windows platform and launches it as an unpackaged app. The terminal command is the same as in the earlier comment. Since the local machine (Windows) is available as the first target, it automatically picks that one, or is it by design to work only with the Windows target in this preview release of the extension? |
And found another issue, Selective targeting is not supported. To narrow down the cause, tried to selectively target Android alone by removing all other target platforms from the project file. The extension reported it with an error message stating .NET MAUI SDK not found. Refer to the below screenshot. This is practically a very valid scenario. So, kindly plan to support this as well. Basically, it should look for the |
Found another issue, terminal commands using single quote char as a delimiter for the Command from the Terminal window (removed username to protect privacy): dotnet build -t:Run -p:Configuration=Debug -f net8.0-android -p:AdbTarget=-s%20127.0.0.1:58526 -p:AndroidAttachDebugger=true -p:AndroidSdbTargetPort=54183 -p:AndroidSdbHostPort=54183 -p:AndroidSdkDirectory='C:\Users\<username>\AppData\Local\Android\Sdk' e:\MAUI\NET_8\Preview_6\MauiApp1\MauiApp1.csproj A reference to the issue logged: dotnet/maui#16091 |
Ooooooh interesting. @egvijayanand if you run |
Yes, @maddymontaquila, have installed the .NET MAUI workload and it's getting listed as well. Facing this Android build issue in CLI outside of VS Code as well. Seems like the Android SDK directory location delimited by the single quote is creating issues all around. Rather it should be delimited by double quotes which is working fine. |
It's weird that maui-android isnt listed - could you try |
Ahhhh ok sorry! I'm wondering if theres an issue because the workloads are all installed via VS, except for maui. Sometimes they randomly conflict even if it looks "ok". @mcumming will look more when he's back from time off - thank you for reporting!!!! |
A good point to start the troubleshooting would be the scenario where Android SDK is installed in a location that is not the default Program Files folder, as it is here shared with Android Studio as well. |
Hi @maddymontaquila, have resolved the Android build issue by editing the extension.js file made available in the folder %UserProfile%\.vscode\extensions\ms-dotnettools.dotnet-maui-0.1.34-win32-x64\dist. At a particular location, where the MSBuild properties are collected, for the Before: n.push(`-p:AndroidSdkDirectory='${o.path}'`) After: n.push(`-p:AndroidSdkDirectory="${o.path}"`) Kindly formalize the fix and provide a solution for Selective Targeting, which can be simulated just by commenting on other TFMs. |
Hi @egvijayanand, Additionally, do you have either the Meteor or Comet extension installed? If so, try disabling them for the current workspace to see if there are possible conflicts occurring. |
There's a fix available for this issue that will be published in the next VS Code MAUI pre-release version. We'll proceed to close this issue once that version is available to install. |
This issue has been marked as stale after 14 days of inactivity.@[@mauroa@], could you please take a look? |
Closing as fixed on latest .NET MAUI pre release |
Describe the Issue
Have installed the .NET MAUI extension.
Opened a .NET MAUI project (
dotnet new maui
).Have selected Windows Subsystem for Android (WSA) as the target device.
Though Android is the opted target platform, it always builds and launches the Windows platform as it's the first device target available on the list.
Steps To Reproduce
Expected Behavior
Expected to build the project and launch in the opted device target.
Environment Information
OS: Windows 11 (v10.0.22621.1928)
VS Code: v1.80.0
.NET MAUI extension: v0.1.34
The text was updated successfully, but these errors were encountered: