Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
lawrence_shaun_introducing_net_maui_build_and_deploy_crosspl.pdf
Скачиваний:
46
Добавлен:
26.06.2023
Размер:
5.15 Mб
Скачать

Chapter 2 Building Our First application

\ 3.\ Verify that the results include maui.

Installed Workload Id Manifest Version Installation Source

------------------------------------------------------

maui 7.0.49/7.0.100 SDK 7.0.100

Creating Your First Application

You will be using the user interface in order to create your application, build, and run it. I will also be including the dotnet command line commands because I find they can be quite helpful when building and debugging.

Creating in Visual Studio

\ 1.\ Launch Visual Studio 2022. In the window that opens, select the Create a new project option. Figure 2-12 shows the initial starting screen in Visual Studio running on Windows with the Create a new project option highlighted.

33

Chapter 2 Building Our First application

Figure 2-12.  Creating a project in Visual Studio

\ 2.\ In the window that follows, type .NET MAUI in the Search for templates box. Then select the .NET MAUI App option and click Next. Figure 2-13 shows the project creation screen with the .NET MAUI App project selected.

34

Chapter 2 Building Our First application

Figure 2-13.  Selecting a .NET MAUI App project type

\ 3.\ In the next window, enter a name for your project. I chose WidgetBoard. Choose a location if you would like to store it somewhere different from the default location, and click Create. Figure 2-14 shows the Configure your new project screen in Visual Studio.

35

Chapter 2 Building Our First application

Figure 2-14.  The Configure your new project dialog

Please bear in mind that Windows has a limitation on the length of the location path. If the path is longer than 255 characters, then strange behavior will follow. Visual Studio will fail to build perfectly valid code and so on. This can be rectified by disabling the path limit (https://learn.microsoft.com/windows/win32/fileio/ maximum-file-path-limitation?tabs=cmd#enable-long- paths-in-windows-10-version-1607-and-later).

\ 4.\ Select the version of .NET you wish to use. At the time of writing this book .NET 7.0 is the current version

so I am using this version. Figure 2-15 shows the Additional information dialog where you can choose the .NET Framework version for your application.

36