#WIP Developer Guide: Running MFConnector with VSCode and Visual Studio

1 messages · Page 1 of 1 (latest)

pine zodiac
#

Hi Developers.

I've setup a VS2022 remote debug session with MF Connector running on my flight sim PC.

I'm guessing here that the MobiFlight design is using a WebServer to display the mainform frontendPanel1 HTML component (for configuration/setup) and that RELEASE version points somewhere different to DEBUG version ?

I wish to compile and debug the C# on my development PC with the .exe running in my SIM PC. I've configured and got working the VS2022 remote debug so i can single step the C# however it's unclear to me how I can remote run the SIM PC .exe without there being a frontend server on the SIM PC ? Are there any pointers from you gurus on how I could make this happen (e.g. run DEBUG version of .exe on SIM PC without having to run the VS code container for frontend on SIM PC ... OR... how I could run the .exe on SIM PC and it use the development PC frontend ) ?

I wish to find/resolve my FSUIPC issue with the Beta release which is why I'm needing to remote debug...

It's a mountain of knowledge for me to climb as this is my first attempt at such work however I'm hopeful there's some documentation or pointers you gurus can share

Thanks

Gary

tawny granite
#

@pine zodiac the easiest way is to set the project up and build and run it locally

cloud python
#

I am not 100% in the know with this, but I run the backend using the VSCode editor and devcontainer (you need Docker or Podman Desktop to run the dev container)

I guess we need a better dev guide, and maybe there is something written up somewhere, but if not, this can be a start of such guide.

Install Podman Desktop

Podman desktop is an open source alternative to Docker Desktop, and lets you run containers on Windows in the Linux subsystem of Windows. Once you have installed it. run it and the desktop app will guide you to install Podman, the container backend engine for you.

#

(I can walk this through if you want)

#

since I just did it

#

either will work, but we can be a bit opinionated for open source 🙂

tawny granite
#

If @cloud python wants to walk you through the process that will help since we don't have docs in place so far

cloud python
#

So as a pre-requisite, either docker or podman needs to be running first. I will show instructions with podman since its what I am familiar with, but it works the same way with Docker too.

You also need to have the MobiFlight-Connector source code git repository locally cloned on your computer.

Open VSCode and click the Extensions button on the left side toolbar, and search for "Dev Containers" extension by Microsoft, and install it.

#

Once it has finished installing, select File -> Open Folder and select the MobiFlight-Connector\frontend\ folder, and when VSCode asks if you trust the folder, select Yes.

EDIT: This was refactored, it seems its now MobiFlight-Connector\src\MobiFlight-Connector\frontend\

#

Maybe it doesnt ask at this point, but I am not 100% sure.

#

Anyway, you should have the folder open like this:

#

On the bottom left corner of the window you have the "remote window" icon:

#

Click that, and it opens a menu on top, select "Reopen in container".

#

And you will get a progress dialog on the bottom right, lets wait until it does everything, it will take a while.

#

you will see the container in podman or docker now:

#

and in vscode there is a lot going on when the container starts and installs everything for you, we just wait a few minutes

#

At this point, open Visual Studio and load the MobiFlightConnector.sln from the main git repository top level folder.

#

And now, if everything worked out, our devcontainer is ready:

#

And when you run the main project in Visual Studio, everything should work:

#

The first time startup will timeout the UI loading, so just close it once, and Start again.

#

@pine zodiac let me know if this works for you. And ask if you have questions or if this doesn't work.

#

success!

cloud python
#

WIP Developer Guide: Running MFConnector with VSCode and Visual Studio

#

oh shoot, I forgot this. IF you are using Podman you also need to edit the DevContainers extension settings and add these two items:

cloud python
#

@pine zodiac does this make sense for you?

#

feel free to ask if something doesn't or fails

pine zodiac
#

Thanks all for the information..

@cloud python I already have the container running on my DEV machine and works OK. What I wish to do is run the container on the remote SIM machine (or know how i can change the MFConnector to use a remote container URL of the DEV machine) 🙏

cloud python
#

@iron socket ping here, see above

#

this is a bit sketchy pile of information now, we should write a proper dev guide to get things running

#

I think if using podman desktop (open source unlike docker desktop) you need to set the devcontainer extension to use podman, let me see

#

I think if using podman desktop (open source unlike docker desktop) you need to set the devcontainer extension to use podman, let me see. In vscode install "Dev Containers" extension from Microsoft, and open Settings behind the gear icon

#

then this is what I had for podman desktop, I think for docker desktop it works with default settings (the docker.sock was likely default setting, podman uses the same)

#

@wheat hatch if there are changes from the .NET migration, lets see that we can do a developer "getting started" guide that explains how to set up the environment, needed tools, and how to set stuff up.

#

this contains now some information that we just need to wrap together into a HOWTO.

wheat hatch
#

I'm a very lazy person, so I'll probably automate this if I can rather than working on step by step guides. The .NET 10 migration unlocks the ability to use JetBrains Rider and VS Code with the repository. A launch profile in VS Code could take care of this

cloud python
#

yea does that use containers or something else?

wheat hatch
#

It should be doable with Dev containers. I've used them briefly so can spend some time seeing what possibilities there are

tawny granite
#

We are all lazy, hence devContainers are a perfect fit.

#

You just need docker or podman and the rest will be taken care of by VSCode if you open the frontend project in a Remote Container.

cloud python
#

not lazy, just smart

iron socket
#

So just so I understand correctly -- the frontend (i.e. web) project should obviously be opened in VS Code?

But MobiFlightConnector itself should still be opened in Visual Studio? Or should that also be opened in VS Code?

And does the frontend source code automatically get copied over to the container when I modify it? Or will I need to have a git repo inside the container somehow?

(I've never worked with containers before, if you can believe that...)

cloud python
#

mobiflight connector loads the frontend inside its window

#

but it is served from the container if I understand it right

#

container runs in WSL Linux, so it mounts the folder inside the container I think

#

it all works automatically, you have the files you can edit and the container builds and serves them

#

so run frontend\ in vscode and open the Visual studio project in visual studio

iron socket
#

Got it, thanks!

iron socket
#

Just wanted to let you know that I've finally gotten round to trying all this out -- and it works!

cloud python
#

sweet!

#

the devcontainer (that I think @ripe cargo set up) helps a lot in getting things running!

cloud python
#

ok I need to figure out why my Visual Studio 2026 does not load the frontend from the container but 2022 does

tawny granite
#

When in DEBUG mode - VS Studio 202X is simply loading "localhost:5173" in a browser window.

#

if it doesn't load that means the frontend is not accessible via localhost:5173

cloud python
#

ok this is useful info too

#

I will clone the repos to my laptop and will do a clean setup from scratch to see if the instructions work

#

to get a doc written