Skip to content

Commit

Permalink
.NET 9 updates (#2615)
Browse files Browse the repository at this point in the history
* .NET 9 updates.

* Update VScode installation.
  • Loading branch information
davidbritch authored Nov 12, 2024
1 parent ec80faa commit 7aa4409
Show file tree
Hide file tree
Showing 45 changed files with 46 additions and 49 deletions.
66 changes: 31 additions & 35 deletions docs/get-started/first-app.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: "Build your first .NET MAUI app"
description: "Learn how to create and run your first .NET MAUI app in Visual Studio 2022 on Windows, or Visual Studio Code with the .NET MAUI extension"
ms.date: 06/12/2024
ms.date: 11/12/2024
zone_pivot_groups: devices-platforms
monikerRange: ">=net-maui-9.0"
---

# Build your first app
Expand All @@ -15,7 +16,7 @@ In this tutorial, you'll learn how to create and run your first .NET Multi-platf

## Prerequisites

- Visual Studio 2022 17.8 or greater, with the .NET Multi-platform App UI workload installed. For more information, see [Installation](installation.md?tabs=vswin).
- Visual Studio 2022 17.12 or greater, with the .NET Multi-platform App UI workload installed. For more information, see [Installation](installation.md?tabs=vswin).

## Create an app

Expand Down Expand Up @@ -76,35 +77,31 @@ In this tutorial, you'll create your first .NET MAUI app in Visual Studio 2022 a

:::image type="content" source="media/first-app/vs/android-emulator-button.png" alt-text="Android emulator button.":::

Visual Studio will start to install the default Android SDK and Android Emulator.
Visual Studio will start the process of installing the default Android SDK and Android Emulator.

01. In the **Android SDK - License Agreement** window, press the **Accept** button:

:::image type="content" source="media/first-app/vs/android-sdk-license1.png" alt-text="First Android SDK License Agreement window.":::

01. In the **Android SDK - License Agreement** window, press the **Accept** button:

:::image type="content" source="media/first-app/vs/android-sdk-license2.png" alt-text="Second Android SDK License Agreement window.":::

01. In the **User Account Control** dialog, press the **Yes** button:

:::image type="content" source="media/first-app/vs/android-sdk-license-uac.png" alt-text="Android SDK license user account control dialog.":::

01. In the **License Acceptance** window, press the **Accept** button:
Wait for Visual Studio to download the default Android SDK and Android Emulator.

:::image type="content" source="media/first-app/vs/android-device-license.png" alt-text="Android device license window.":::
01. In the **User Account Control** dialog, press the **Yes** button:

Wait for Visual Studio to download the Android SDK and Android Emulator.
:::image type="content" source="media/first-app/vs/android-device-manager-uac.png" alt-text="Android Device Manager user account control dialog.":::

01. In the Visual Studio toolbar, press the **Android Emulator** button:
01. In the **Android SDK Platform is missing** dialog, press the **Install** button:

:::image type="content" source="media/first-app/vs/android-emulator-button.png" alt-text="Android emulator button.":::
:::image type="content" source="media/first-app/vs/android-sdk-platform-missing.png" alt-text="Android SDK platform is missing dialog.":::

Visual Studio will start to create a default Android emulator.
01. In the **Android SDK - License Agreement** window, press the **Accept** button:

01. In the **User Account Control** dialog, press the **Yes** button:
:::image type="content" source="media/first-app/vs/android-sdk-license2.png" alt-text="Second Android SDK License Agreement window.":::

:::image type="content" source="media/first-app/vs/android-device-manager-uac.png" alt-text="Android Device Manager user account control dialog.":::
Wait for Visual Studio to install the Android SDK components.

01. In the **New Device** window, press the **Create** button:

Expand All @@ -116,9 +113,23 @@ In this tutorial, you'll create your first .NET MAUI app in Visual Studio 2022 a

:::image type="content" source="media/first-app/vs/android-device-manager.png" alt-text="Android Device Manager window.":::

01. In the Visual Studio toolbar, press the **Pixel 5 - API 34 (Android 14.0 - API 33)** button to build and run the app:
01. In the Visual Studio toolbar, press the **Pixel 7 - API 35 (Android 15.0 - API 35)** button:

:::image type="content" source="media/first-app/vs/pixel7-api-35.png" alt-text="Pixel 7 API 35 emulator button.":::

01. In the **Android SDK - License Agreement** window, press the **Accept** button:

:::image type="content" source="media/first-app/vs/android-sdk-license3.png" alt-text="Third Android SDK License Agreement window.":::

:::image type="content" source="media/first-app/vs/pixel5-api-34.png" alt-text="Pixel 5 API 34 emulator button.":::
01. In the **User Account Control** dialog, press the **Yes** button:

:::image type="content" source="media/first-app/vs/android-sdk-license-uac.png" alt-text="Android SDK license user account control dialog.":::

Wait for Visual Studio to install to download the Android SDK.

01. In the Visual Studio toolbar, press the **Pixel 7 - API 35 (Android 15.0 - API 35)** button to build and run the app:

:::image type="content" source="media/first-app/vs/pixel7-api-35.png" alt-text="Pixel 5 API 35 emulator button.":::

Visual Studio will start the Android emulator, build the app, and deploy the app to the emulator.

Expand All @@ -138,25 +149,10 @@ If your app fails to compile, review [Troubleshooting known issues](../troublesh
:::zone pivot="devices-windows"

<!-- markdownlint-disable MD029 -->
06. In the Visual Studio toolbar, use the **Debug Target** drop-down to select **Framework** and then the **net8.0-windows** entry:

:::image type="content" source="media/first-app/vs/windows-debug-target.png" alt-text="Select the Windows Machine debugging target for .NET MAUI.":::

<!-- markdownlint-enable MD029 -->

01. In the Visual Studio toolbar, press the **Windows Machine** button to build and run the app:
06. In the Visual Studio toolbar, press the **Windows Machine** button to build and run the app:

:::image type="content" source="media/first-app/vs/windows-run-button.png" alt-text="Run .NET MAUI app in Visual Studio button.":::

If you've not enabled Developer Mode, Visual Studio will prompt you to enable it. In the **Enable Developer Mode for Windows** dialog, click **settings for developers** to open the Settings app:

:::image type="content" source="media/first-app/vs/windows-enable-developer-mode.png" alt-text="Enable Windows developer mode dialog.":::

In the Settings app, turn on **Developer Mode** and accept the disclaimer:

:::image type="content" source="media/first-app/vs/windows-developer-mode-win11.png" alt-text="Developer Mode toggle on the Windows 11 settings app.":::

Close the Settings app and then close the **Enable Developer Mode for Windows** dialog.
<!-- markdownlint-enable MD029 -->

01. In the running app, press the **Click me** button several times and observe that the count of the number of button clicks is incremented:

Expand Down Expand Up @@ -197,7 +193,7 @@ If your app fails to compile, review [Troubleshooting known issues](../troublesh

:::zone pivot="devices-maccatalyst"

.NET MAUI apps that target Mac Catalyst can only be launched and debugged using Visual Studio 2022 for Mac.
.NET MAUI apps that target Mac Catalyst can only be launched and debugged using Visual Studio Code.

:::zone-end

Expand Down
23 changes: 12 additions & 11 deletions docs/get-started/installation.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
title: "Install Visual Studio 2022 and Visual Studio Code to develop cross-platform apps using .NET MAUI"
description: "Learn how to install Visual Studio 2022 and Visual Studio Code with the .NET MAUI extension to develop native, cross-platform apps using .NET MAUI."
ms.date: 06/12/2024
ms.date: 11/12/2024
monikerRange: ">=net-maui-9.0"
---

# Installation

Developing native, cross-platform .NET Multi-platform App UI (.NET MAUI) apps requires Visual Studio 2022 17.8 or greater, or the latest Visual Studio Code with the .NET MAUI extension.
Developing native, cross-platform .NET Multi-platform App UI (.NET MAUI) apps requires Visual Studio 2022 17.12 or greater, or the latest Visual Studio Code with the .NET MAUI extension.

<!-- markdownlint-disable MD025 -->
# [Visual Studio](#tab/vswin)
<!-- markdownlint-enable MD025 -->

To start developing native, cross-platform .NET MAUI apps on Windows, install Visual Studio 2022 17.8 or greater by following the [installation](#installation) steps.
To start developing native, cross-platform .NET MAUI apps on Windows, install Visual Studio 2022 17.12 or greater by following the [installation](#installation) steps.

## Prerequisites

- Visual Studio 2022 17.8 or greater. For information about supported operating systems, hardware, supported languages, and additional requirements and guidance, see [Visual Studio 2022 System Requirements](/visualstudio/releases/2022/system-requirements).
- Visual Studio 2022 17.12 or greater. For information about supported operating systems, hardware, supported languages, and additional requirements and guidance, see [Visual Studio 2022 System Requirements](/visualstudio/releases/2022/system-requirements).

To build, sign, and deploy .NET MAUI apps for iOS, you'll also need:

Expand Down Expand Up @@ -68,7 +69,7 @@ To build, sign, and deploy .NET MAUI apps for iOS, you'll need:
## Install .NET and .NET MAUI workloads

1. Install [.NET 8](/dotnet/core/install/windows).
1. Install [.NET 9](/dotnet/core/install/windows).

On Windows, it's recommended to use the Visual Studio installer to manage .NET and the .NET MAUI workload installations. Instructions on using the Visual Studio installer can be found [here](installation.md?tabs=vswin).

Expand Down Expand Up @@ -101,8 +102,8 @@ To debug a .NET MAUI app in Visual Studio Code, you need to have a valid target
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
```

| Your Operating System | Supported Target Platforms |
Expand Down Expand Up @@ -140,10 +141,10 @@ If you try to create a new project and the file explorer keeps popping up in an

#### Using the InstallAndroidDependencies target

.NET 8 has a build target that helps set up your Android environment for you. Run the following command in a terminal to configure your machine and set up your Android environment:
.NET 9 has a build target that helps set up your Android environment for you. Run the following command in a terminal to configure your machine and set up your Android environment:

```dotnetcli
dotnet build -t:InstallAndroidDependencies -f:net8.0-android -p:AndroidSdkDirectory="<AndroidSdkPath>" -p:JavaSdkDirectory="<JavaSdkPath>" -p:AcceptAndroidSDKLicenses=True
dotnet build -t:InstallAndroidDependencies -f:net9.0-android -p:AndroidSdkDirectory="<AndroidSdkPath>" -p:JavaSdkDirectory="<JavaSdkPath>" -p:AcceptAndroidSDKLicenses=True
```

In the command above:
Expand All @@ -166,7 +167,7 @@ In the command above:
* build-tools >= 34.0.0
* cmdline-tools == 11.0
* platforms;android-34*
* .NET 8: platform-tools = 34.0.5
* .NET 9: platform-tools = 34.0.5

#### There's an error that Android licenses aren't accepted

Expand All @@ -186,7 +187,7 @@ This is a known issue if you install to `%APPDATA%` on Windows and will be fixed

* Debugging can fail to start for multiple reasons. If there isn't a clear error in the **Output** window, first double check that you're using the **C#** run configuration in Visual Studio Code.
* If you're using an older version of .NET, the C# debugger isn't supported for .NET MAUI apps. You can use the legacy .NET MAUI debug configuration by unchecking the extension setting **MAUI > Configuration > Experimental > Use VSDbg**.
* You can try a command line build from the terminal to see if the error is with your code or the .NET MAUI extension. For example, you could run `dotnet build -f:net8.0-android` to see if your Android build succeeds outside of Visual Studio Code. If this build succeeds, please [Report an Issue](https://github.com/microsoft/vscode-dotnettools/issues)
* You can try a command line build from the terminal to see if the error is with your code or the .NET MAUI extension. For example, you could run `dotnet build -f:net9.0-android` to see if your Android build succeeds outside of Visual Studio Code. If this build succeeds, please [Report an Issue](https://github.com/microsoft/vscode-dotnettools/issues)

## Known limitations

Expand Down
Binary file modified docs/get-started/media/first-app/vs/additional-information.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/get-started/media/first-app/vs/android-debug-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/get-started/media/first-app/vs/android-device-manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/get-started/media/first-app/vs/android-running-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/get-started/media/first-app/vs/android-sdk-license1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/get-started/media/first-app/vs/android-sdk-license2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/get-started/media/first-app/vs/ios-chosen-debug-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/get-started/media/first-app/vs/ios-debug-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/get-started/media/first-app/vs/ios-running-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/get-started/media/first-app/vs/new-android-device.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/get-started/media/first-app/vs/windows-running-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed docs/get-started/media/first-app/vsmac/ios-run.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed docs/get-started/media/first-app/vsmac/mac-run.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
4 changes: 2 additions & 2 deletions docs/ios/pair-to-mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Pair to Mac enables the following software development workflow:
- It's possible to use the Windows command-line to build iOS apps.

> [!NOTE]
> Before following the instructions in this article, on a Mac, [install Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12). Then manually open Xcode, after installation, so that it can add additional components. In addition, you should also install either the latest [Visual Studio 2022 for Mac](https://visualstudio.microsoft.com/vs/mac/) or [Mono](https://www.mono-project.com/download/stable/#download-mac). In addition, if you have a Mac computer with Apple silicon please ensure that Rosetta is installed.
> Before following the instructions in this article, on a Mac, [install Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12). Then manually open Xcode, after installation, so that it can add additional components. You should also install [Mono](https://www.mono-project.com/download/stable/#download-mac). In addition, if you have a Mac computer with Apple silicon please ensure that Rosetta is installed.
>
> If you would prefer not to install Visual Studio 2022 for Mac, Visual Studio 2022 can automatically configure the Mac build host. However, you must still install and run Xcode, and install Mono.
> Visual Studio 2022 will automatically configure the Mac build host. However, you must still install and run Xcode, and install Mono.
## Enable remote login on the Mac

Expand Down
2 changes: 1 addition & 1 deletion docs/xaml/hot-reload.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ By default, you don't need to save your XAML file to see the results of your edi
> [!NOTE]
> If you're writing a native UWP or WPF app, without using .NET MAUI, see [What is XAML Hot Reload for WPF and UWP apps?](/visualstudio/xaml-tools/xaml-hot-reload).
XAML Hot Reload is available in both Visual Studio 2022 and Visual Studio 2022 for Mac. On Windows, XAML Hot Reload is available on Android, iOS, and WinUI on emulators, simulators, and physical devices. On Mac, XAML Hot Reload is available on Android, iOS, and Mac Catalyst on emulators, simulators, and physical devices. In all cases, XAML Hot Reload requires your debug configuration to be named `Debug`.
XAML Hot Reload is available in both Visual Studio 2022 and Visual Studio Code. On Windows, XAML Hot Reload is available on Android, iOS, and WinUI on emulators, simulators, and physical devices. On Mac, XAML Hot Reload is available on Android, iOS, and Mac Catalyst on emulators, simulators, and physical devices. In all cases, XAML Hot Reload requires your debug configuration to be named `Debug`.

> [!IMPORTANT]
> XAML Hot Reload doesn't reload C# code. If you add a new event handler in code, it can only be used in XAML after the code is reloaded. In addition, if you add a new XAML element with an `x:Name`, the name cannot be used in code until the code is reloaded.
Expand Down

0 comments on commit 7aa4409

Please sign in to comment.