microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
192 stars 6 forks source link

Open an existing MAUI Project and run it from VSCode #1069

Closed krobine1 closed 3 weeks ago

krobine1 commented 3 weeks ago

Describe the Issue

I am attempting to pull over a .NET MAUI project developed and tested in Visual Studio Professional 2022, using .NET 8. Upon opening the project, I can see the files XML. Upon clicking Run and Debug, I can select .NET MAUI. Then, nothing happens. I don't see the Debug/Terminal pane.

Steps To Reproduce

  1. Create new folder using Windows Explore.
  2. Place my Project folder created from VS Professional 2022 (.NET 8) in folder created above.
  3. In VS Code, File -> Open Folder and select folder created in Step 1.
  4. File -> Open and open the .csproj file located in the project folder created in Step 2. I can see the .xml associated with the project.
  5. Click Run -> Select .NET MAUI.
  6. Nothing happens. No Terminal/Debug console. no {} showing up. Nothing. Also, when opening the MauiProgram.cs file, I can't see anything.

Expected Behavior

I am hoping that I can take a .NET Maui application developed in Visual Studio Professional 2022 (.NET 8) and run it using VSCode (I need to do this on a Mac). Would also be nice if I can open my solution file directly. Also, it would be nice to see some documentation describing how to do this. Thank you. Looking forward to seeing this Product working well for .NET MAUI applications.

Environment Information

No response

mauroa commented 3 weeks ago

Hi @krobine1.

Just to double check, do you have the C#, C# DevKit and .NET MAUI extensions installed in VS Code?

Then, you don't need to do step #4 if you already opened a folder that contains your solution/project.

After you folder is opened, you should see C#, C# DevKit and .NET MAUI extensions being loaded. You can also verify this by looking at the corresponding Output panes (C#. C# DevKit and MAUI). You can paste the content here so I can see what's being reported by them.

Also, after .NET MAUI is loaded, you should see the '{}' at the bottom right and select the right startup project and debug target, so then you can do F5 and select .NET MAUI as the debugger.

Please note that '{}' will be shown only if you open a code file (.cs, .xaml, etc.).

Please let me know how it goes. Thanks.

krobine1 commented 3 weeks ago

Hello mauroa :

Thanks so much for responding.

Yes, C#, C# DevKit and .NET MAUI is definitely loaded (ran a brand new project when I first installed it). In addition, it's working great now actually with a slight change to my steps (I have a folder with a solution file in there. Then in there, I have another folder with the project file and code. This was developed in VS Professional 2022, .NET 8).

Steps follow:

  1. Open folder containing the solution file. Now I can see the the .NET MAUI extension being loaded.
  2. Open the MauiProgram.cs file. Now I can see the '{}' at the bottom right.
  3. I'm able to use the Debug Target to change execution environments now too (ran it using Windows and an Android Emulator. Still need to test via actual devices).
  4. It runs great in both of those environments (very complicated project too).

Next up is taking my .NET MAUI app developed on a windows machine and placing it on a Mac running Visual Studio code (it'll take a while to get that setup in my agency). Then running it through XCode. Very excited to see this work though. Thanks again.

github-actions[bot] commented 3 weeks ago

@mauroa, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.