4. Getting Started
Step 1: Download and unzip StarterApp
- Click Download StarterApp ZIP
- Extract the ZIP file to your desired location (e.g.,
~/Projects/StarterAppon Mac or Linux;C:\Projects\StarterAppon Windows)
The StarterApp provides:
- Docker Compose setup with MAUI app container + PostgreSQL container
- Basic authentication and navigation (already implemented - use this for API auth)
- Entity Framework Core with migrations
- Connection to containerised PostgreSQL 16
Apple Silicon Macs
Edit the
docker-compose.ymlfile and uncomment the lineplatform: linux/amd64as we did in the setup tutorial.
Step 2: Configure Database Connection
StarterApp provides an appsettings.json.template in the StarterApp.Database for you to configure.
For local development, the app connects to PostgreSQL using:
"Host=10.0.2.2:5432;Username=app_user;Password=app_password;Database=appdb";
10.0.2.2 is the IP address of the Docker host machine.
Once you have updated the connection string, change the name of the file to appsettings.json (i.e. remove the .template).
Check that the database is accessible using the database option in the left-hand menu in VS Code. You should see a Postgres connection named AppDB.
Step 3: Reset the container environment
In StarterApp, Docker Compose is configured to create the required tables in the database when you first build the container. However, there may be conflicts with the previous exercise. To prevent this, we will tell Docker Compose to remove the existing database and recreate it. In a terminal window on the host computer, change into the project home directory and execute the following command:
1
docker compose down -v
This will stop and remove all old containers, networks, and volumes and set up new ones for StarterApp. You should only have to do this once if you are working on your own computer. If you are using one of the lab machines, you can skip this step if this is a fresh session and you are not coming directly from the setup tutorial.
Step 4: Open in VS Code Dev Container
- Open the project folder in VS Code
- Click “Reopen in Container” when prompted
Step 5: Rebuild everything
Note
The first time they are run, some of these steps take several minutes - please be patient. Wait until each task has finished before starting the next.
- Activate the command palette with SHIFT+CTRL+P or SHIFT+CMD+P and choose
Dev Containers: Rebuild Container Without Cache. This task is finished when you can seeProjects: 3in the status bar. If it looks as though there is a pending task labelledAndroid: Analyzing Environment..., you can ignore it. -
Use the command palette to start a new terminal window. Then execute the following commands:
1 2
dotnet clean dotnet build -c Debug
Monitor the build
Sometimes the build step can get stuck at the
_CompileResourcesstep. If this step takes longer than 10s, open another terminal and execute the following steps:
- Find the process number of the build command with
pgrep -a dotnet. The process number you need is the one at the start of the line that containsdotnet build.- Kill the process with the command
kill -9 XXXwhereXXXis the process number from the previous step.- Close the new terminal with the command
exit.- Back in the original terminal, run the same command again.
Step 6: Test the Starter App
Locate the file com.companyname.starterapp-Signed.apk in the bin/Debug/net10.0-android folder.
Check that the emulator and the ADB server are running on the host computer. Then execute the following commands:
1
2
adb uninstall com.companyname.starterapp
adb install -r PATH_TO_YOUR_APK_FILE
Once installed, launch the app from the emulator.