Skip to content

Commit e500172

Browse files
niels9001jwmsft
andauthored
WinUI Hello World refresh (#5932)
* Updated content * Update start-here.md * Updated images * Update start-here.md * Update start-here.md * Update start-here.md * Update start-here.md * Update start-here.md * Update start-here.md * Update start-here.md * Update hub/apps/get-started/start-here.md Co-authored-by: Jim Walker <[email protected]> * Update hub/apps/get-started/start-here.md Co-authored-by: Jim Walker <[email protected]> * Update hub/apps/get-started/start-here.md * Fix link to notetaking app tutorial --------- Co-authored-by: Jim Walker <[email protected]>
1 parent 75abb5a commit e500172

7 files changed

Lines changed: 33 additions & 83 deletions

File tree

37.6 KB
Loading
14.6 KB
Loading
250 Bytes
Loading
2.98 KB
Loading
4.8 KB
Loading
51 KB
Loading

hub/apps/get-started/start-here.md

Lines changed: 33 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ ms.localizationpriority: medium
88
ms.collection: windows11
99
---
1010

11-
# Start developing Windows apps
11+
# Setup and tooling for WinUI
1212

13-
Welcome to Windows app development. This guide takes you through the steps needed to begin creating apps by using the latest Windows development frameworks: the Windows App SDK and WinUI. It also points you to resources that help you learn more about Windows development. For a step-by-step guide to setting up your developer environment and building your first WinUI app with the latest tools, see [WinUI 101](/training/modules/winui-101/). If you're already comfortable developing apps for Windows but want to know more about the latest tools, see [Develop Windows desktop apps](/windows/apps/develop/).
14-
15-
> [!TIP]
16-
> [Microsoft Copilot](https://copilot.microsoft.com) is a great resource if you have questions about getting started writing Windows apps.
13+
Welcome to Windows app development. This guide will take you through the steps needed to begin creating your first app with WinUI. It will also point you to resources that will help you learn more about Windows development. If you want a step-by-step guide to setting up your developer environment and building your first WinUI app with the latest tools, please see [WinUI 101](/training/modules/winui-101/).
1714

1815

1916
## 1. Enable Developer Mode
@@ -25,54 +22,57 @@ Windows has a special mode for developers that adjusts security settings so you
2522
2623
To enable Developer Mode:
2724

28-
* Open Windows Settings and go to the **[System > For developers](ms-settings:developers)** page.
29-
* Toggle the Developer Mode switch to **On** and confirm your choice in the confirmation dialog.
25+
* Open Windows Settings and navigate to the **[System > Advanced](ms-settings:developers)** page.
26+
* Toggle the **Developer Mode** switch to **On** and confirm your choice in the confirmation dialog.
3027

3128
For more information about Developer Mode, see [Enable your device for development](/windows/apps/get-started/enable-your-device-for-development).
3229

3330

34-
## 2. Install Visual Studio
31+
## 2. Install Visual Studio and required workloads
3532

36-
Use [Visual Studio](/visualstudio/ide/), Microsoft's comprehensive integrated development environment (IDE), to create your WinUI app. It's the preferred development tool of many Windows developers and it helps you write, debug, and deploy your apps. The project templates in Visual Studio quickly get you started with projects for Windows and many other platforms.
33+
Use [Visual Studio](/visualstudio/ide/), Microsoft’s powerful IDE, to build, debug, and deploy your WinUI app. It offers ready-to-use project templates for Windows and other platforms to help you get started quickly.
3734

38-
> [!TIP]
39-
> Before installing these tools, make sure your development computer meets the [system requirements for Windows app development](../windows-app-sdk/system-requirements.md).
35+
The free **Visual Studio Community Edition** includes everything you need to develop apps. Larger teams or enterprises may require **Professional** or **Enterprise** editions. Learn more in [What is Visual Studio?](/visualstudio/get-started/visual-studio-ide) and [system requirements for Windows app development](../windows-app-sdk/system-requirements.md).
36+
37+
#### [WinGet](#tab/winget)
38+
39+
Install the required tools and workloads by running one of the following commands in the console.
40+
The command opens the Visual Studio Installer with any missing workloads preselected — just choose **Modify** to install them.
41+
42+
If you prefer, you can replace *Community* with *Professional* or *Enterprise* to install those editions instead.
43+
44+
**For C# app development**
45+
```console
46+
winget install "Visual Studio Community 2022" --override "--add Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.ComponentGroup.WindowsAppSDK.Cs" -s msstore
47+
```
48+
49+
**For C++ app development**
50+
```console
51+
winget install "Visual Studio Community 2022" --override "--add Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.ComponentGroup.WindowsAppSDK.Cpp" -s msstore
52+
```
53+
54+
#### [Manual installation](#tab/manual)
4055

4156
Use the following link to download and install the latest Visual Studio. The installer walks you through the steps, but if you need detailed instructions, see [Install Visual Studio](/visualstudio/install/install-visual-studio).
4257

4358
> [!div class="button"]
4459
> [Download Visual Studio](https://visualstudio.microsoft.com/downloads/)
4560
46-
The free Visual Studio Community Edition includes everything you need to create your apps. If you're working with a development team or enterprise, you might need Visual Studio Professional or Visual Studio Enterprise. See [What is Visual Studio?](/visualstudio/get-started/visual-studio-ide) for more info.
47-
48-
### 2.2 Required workloads and components
61+
#### Required workloads and components
4962

5063
While installing Visual Studio, install the workloads and components required for developing with WinUI and the Windows App SDK. After installation, you can open the Visual Studio Installer app and select **Modify** to add workloads and components.
5164

5265
On the **Workloads** tab of the Visual Studio Installer app, select the following workloads and components:
5366

54-
#### [Visual Studio 2022 version 17.10 and later](#tab/vs-2022-17-10)
55-
56-
* For **C#** app development using the Windows App SDK, select **WinUI application development**.
67+
* **For C# app development** using the Windows App SDK, select **WinUI application development**.
5768

5869
:::image type="content" source="images/hello-world/vs-workload-winui.png" alt-text="A screenshot of the Visual Studio installer UI with the WinUI application development workload selected.":::
5970

60-
* For **C++** app development using the Windows App SDK, select **WinUI application development**.
61-
* Then in the **Installation details** pane, under the **WinUI application development** node, select **C++ WinUI app development tools**. (This selection also includes any additional required components.)
62-
63-
:::image type="content" source="images/hello-world/vs-workload-winui-cpp.png" alt-text="A screenshot of the Visual Studio installer UI with the C++ WinUI app development tools selected.":::
71+
* **For C++ app development**, select the **C++ WinUI app development tools** under the **WinUI application development** node in the **Installation details** pane (This will also select any additional required components.)
6472

6573
> [!NOTE]
6674
> _In Visual Studio 17.10 - 17.12, this workload is called **Windows application development**._
6775
68-
#### [Visual Studio 2022 version 17.1 - 17.9](#tab/vs-2022-17-1)
69-
70-
* For **C#** app development using the Windows App SDK, select **.NET Desktop Development**.
71-
* Then in the **Installation details** pane of the installation dialog box, select **Windows App SDK C# Templates** (near the bottom of the list).
72-
* For **C++** app development using the Windows App SDK, select **Desktop development with C++**
73-
* Then in the **Installation details** pane of the installation dialog box, select **Windows App SDK C++ Templates** (at the bottom of the list).
74-
* On the **Individual components** tab of the installation dialog box, in the **SDKs, libraries, and frameworks** section, make sure the latest Windows SDK is selected. It looks like **Windows 11 SDK (10.0.22621.0)**. Type "Windows SDK" into the search box to make it easier to find.
75-
7676
---
7777

7878
## 3. Create and launch your first WinUI app
@@ -95,67 +95,17 @@ To create a new project by using the WinUI C# Blank App project template:
9595

9696
1. Select the **Debug** "Start" button to build and run your project:<br/>
9797
:::image type="content" source="images/hello-world/start-click.png" alt-text="Build and run your project":::<br/>
98-
Your project builds, deploys to your local machine, and runs in debug mode:<br/>
99-
:::image type="content" source="images/hello-world/click-me.png" alt-text="Hello World project built and running":::
98+
Your project will build, be deployed to your local machine, and run in debug mode:<br/>
99+
:::image type="content" source="images/hello-world/click-me.png" border="false" alt-text="Hello World project built and running":::
100100

101101
1. To stop debugging, close the app window, or select the debug "Stop" button in Visual Studio.
102102

103-
## 4. Delete sample code
104-
105-
The `MainWindow` class included with the project template contains sample code that you need to remove to make room for your content.
106-
107-
1. Double-click `MainWindow.xaml` in **Solution Explorer** to open it. You should see XAML markup for a `StackPanel` control.
108-
1. Delete the XAML for the `StackPanel`. (You'll add your own content in its place as you create your app.)
109-
110-
```xaml
111-
<!-- ↓ Delete this. ↓ -->
112-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
113-
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
114-
</StackPanel>
115-
```
116-
117-
If you try to run your app now, Visual Studio throws an error along the lines of `The name 'myButton' does not exist in the current context`. This error occurs because you deleted the `Button` control named `myButton`, but the `MainPage.xaml.cs` code-behind file still references it. Delete the reference in the code file, too.
118-
119-
1. Double-click `MainWindow.xaml.cs` in **Solution Explorer** to open it.
120-
1. Delete the `myButton_Click` event handler.
121-
122-
```csharp
123-
public sealed partial class MainWindow : Window
124-
{
125-
public MainWindow()
126-
{
127-
this.InitializeComponent();
128-
}
129-
130-
// ↓ Delete this. ↓
131-
private void myButton_Click(object sender, RoutedEventArgs e)
132-
{
133-
myButton.Content = "Clicked";
134-
}
135-
// End delete.
136-
}
137-
```
138-
139-
1. Save the file by pressing <kbd>CTRL + SHIFT + S</kbd>, clicking the **Save All** icon in the tool bar, or by selecting the menu **File** > **Save All**.
140-
141-
## 5. Update to the latest WinUI/Windows App SDK
142-
143-
The Windows App SDK (and WinUI, which is part of it) is distributed as a [NuGet](/nuget/what-is-nuget) package. This distribution method means updates can be released out-of-sync with Windows and Visual Studio. As a result, the Visual Studio template you used to create your project might not reference the latest Windows App SDK NuGet package. To ensure you have the latest features and fixes, update your NuGet packages every time you create a new project in Visual Studio.
144-
145-
To update the Windows App SDK NuGet package for your project:
146-
147-
* In Visual Studio, with your project loaded, select **Tools** > **NuGet Package Manager** > **Manage NuGet Packages for Solution...**.
148-
* If an update is available, it appears on the **Updates** page. Check the box next to the listed update. (To include prerelease updates, check the **Include prerelease** option. To learn more about what's included in an update, see the [release notes](../windows-app-sdk/stable-channel.md).)
149-
* Select **Update**, then select **Apply** in the **Preview changes** dialog. Accept the license terms to finish installing the update.
150-
151-
:::image type="content" source="images/hello-world/nuget-update.png" alt-text="A screenshot of the NuGet package manager in Visual Studio showing a Windows App SDK package update.":::
152-
153-
Now your project uses the latest WinUI features, and it's ready for you to make it your own.
103+
Congratulations, you've just built your first WinUI app! Continue with the next steps below to explore more.
154104

155105
## Next steps
156106

157107
> [!div class="nextstepaction"]
158-
> [Complete a tutorial to create a note app with WinUI](../tutorials/winui-notes/intro.md)
108+
> [Build your first notetaking app with WinUI](../tutorials/winui-notes/intro.md)
159109
160110
* To get an idea of what WinUI offers, check out the WinUI Gallery app.
161111
[!INCLUDE [winui-3-gallery](../../includes/winui-3-gallery.md)]

0 commit comments

Comments
 (0)