.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
Перейти к файлу
Jonathan Peppers 3f78ce00ab
.NET MAUI is now a "workload" (#603)
TDLR: Microsoft.Maui.* NuGet packages are removed in favor of .NET
Workloads.

See `src/Workloads/README.md` for full details.

The idea, is a project to be able to set `$(UseMaui)`:

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>net6.0-android</TargetFramework>
        <OutputType>Exe</OutputType>
        <UseMaui>true</UseMaui>
      </PropertyGroup>
    </Project>

`$(UseMaui)` automatically brings in the following workload packs:

* `Microsoft.NET.Sdk.Maui`
* `Microsoft.Maui.Controls.Sdk`
* `Microsoft.Maui.Resizetizer.Sdk`
* `Microsoft.Maui.Core.Ref.[platform]`
* `Microsoft.Maui.Core.Runtime.[platform]`
* `Microsoft.Maui.Controls.Ref.[platform]`
* `Microsoft.Maui.Controls.Runtime.[platform]`
* `Microsoft.Maui.Dependencies`
* `Microsoft.Maui.Essentials.Ref.[platform]`
* `Microsoft.Maui.Essentials.Runtime.[platform]`
* `Microsoft.Maui.Extensions`
* `Microsoft.Maui.Templates`

BlazorWebView is an addition to MAUI, project can currently opt into
it by adding `.Razor` to the `Sdk` attribute.

`<Project Sdk="Microsoft.NET.Sdk.Razor">` sets
`$(UsingMicrosoftNETSdkRazor)`, which triggers the MAUI workload to
include:

* `Microsoft.AspNetCore.Components.WebView.Maui`

This will automatically add these dependencies:

    <PackageReference Include="Microsoft.AspNetCore.Authorization" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebView" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" />
    <PackageReference Include="Microsoft.JSInterop" />

If you are a .NET 6 project, but don't want to use
Microsoft.Maui.Controls you could bring in partial parts of MAUI.

`$(UseMauiAssets)` brings in `Microsoft.Maui.Resizetizer.Sdk`.

`$(UseMauiCore)` brings in:

* `Microsoft.Maui.Core.Ref.[platform]`
* `Microsoft.Maui.Core.Runtime.[platform]`

`$(UseMauiEssentials)` brings in:

* `Microsoft.Maui.Essentials.Ref.[platform]`
* `Microsoft.Maui.Essentials.Runtime.[platform]`

Special files:

* `AutoImport.props` - defines the default includes (or wildcards) for
  Maui projects will go. Note that this is imported by *all* .NET 6
  project types -- *even non-mobile ones*.
* `WorkloadManifest.json` - general .NET workload configuration
* `WorkloadManifest.targets` - imports `Microsoft.Maui.Controls.Sdk` when
  `$(UseMaui)` is `true`. Note that this is imported by *all* .NET 6
  project types -- *even non-mobile ones*.

For further details about .NET Workloads, see these .NET design docs:

* [.NET Optional SDK Workloads](https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workloads.md)
* [Workload Resolvers](https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-resolvers.md)
* [Workload Manifests](b82449a228/accepted/2020/workloads/workload-manifest.md)
2021-06-16 17:59:53 +01:00
.config [build] Use arcade dependency management (#729) 2021-04-15 19:49:21 +01:00
.github Add note on SemanticsPage to PR template 2021-04-22 13:26:22 -04:00
.nuspec .NET MAUI is now a "workload" (#603) 2021-06-16 17:59:53 +01:00
.vscode Add DeviceTests to the net6 sln (#1099) 2021-06-14 13:17:39 -05:00
Assets
eng .NET MAUI is now a "workload" (#603) 2021-06-16 17:59:53 +01:00
src .NET MAUI is now a "workload" (#603) 2021-06-16 17:59:53 +01:00
.editorconfig [build] Update to .NET 6 Preview 4 (#796) 2021-04-24 11:32:18 +01:00
.gitattributes
.gitconfig
.gitignore Added .DS_Store to the gitignore (#512) 2021-03-15 15:29:51 -06:00
BlazorNonWindows-net6.sln Add new solutions for Blazor Desktop work (#1251) 2021-06-10 22:52:04 -04:00
BlazorWindows-net6.sln Add new solutions for Blazor Desktop work (#1251) 2021-06-10 22:52:04 -04:00
BlazorWindowsDesktop-net6.sln Add WPF and WinForms BlazorWebView controls (#1199) 2021-06-09 09:55:58 +01:00
Compatibility.ControlGallery.sln Convert Compatibility non net6 to be multi targeted (#1079) 2021-05-25 08:54:44 -05:00
Directory.Build.props .NET MAUI is now a "workload" (#603) 2021-06-16 17:59:53 +01:00
Directory.Build.targets Add DeviceTests to the net6 sln (#1099) 2021-06-14 13:17:39 -05:00
GitInfo.txt Update GitInfo.txt (#1303) 2021-06-14 19:06:19 +01:00
LICENSE
Microsoft.Maui-net6.sln .NET MAUI is now a "workload" (#603) 2021-06-16 17:59:53 +01:00
Microsoft.Maui.BuildTasks-net6.sln Fix WinUI and Control Gallery builds (#1095) 2021-05-27 14:20:36 +02:00
Microsoft.Maui.BuildTasks.sln Fix WinUI and Control Gallery builds (#1095) 2021-05-27 14:20:36 +02:00
Microsoft.Maui.Droid.sln .NET MAUI is now a "workload" (#603) 2021-06-16 17:59:53 +01:00
Microsoft.Maui.Samples-net6.slnf .NET MAUI is now a "workload" (#603) 2021-06-16 17:59:53 +01:00
Microsoft.Maui.WinUI.sln Add WPF and WinForms BlazorWebView controls (#1199) 2021-06-09 09:55:58 +01:00
Microsoft.Maui.iOS.sln Fix WinUI and Control Gallery builds (#1095) 2021-05-27 14:20:36 +02:00
Microsoft.Maui.sln Source Generator for XamlG and CssG (#1006) 2021-05-26 09:47:25 -04:00
Microsoft.Maui.sln.DotSettings Rename all of the things... All of them. (#13847) 2021-02-24 23:50:31 +00:00
NuGet.config Update WinUI and merge projects (#1117) 2021-06-09 13:20:27 -04:00
README.md Add new solutions for Blazor Desktop work (#1251) 2021-06-10 22:52:04 -04:00
SECURITY.md
build.cake Try fix android (#1170) 2021-06-03 17:26:11 -04:00
build.cmd
build.ps1 Remove DevopsNuget.config (#13814) 2021-02-22 18:02:09 +00:00
build.sh Remove DevopsNuget.config (#13814) 2021-02-22 18:02:09 +00:00
global.json [build] Use arcade dependency management (#729) 2021-04-15 19:49:21 +01:00

README.md

Introducing .NET Multi-platform App UI (MAUI)

.NET MAUI is:

  • Multi-platform native UI
  • Deploy to multiple devices across mobile & desktop
  • Using a single project, single codebase
  • Evolution of Xamarin.Forms
  • .NET 6

Build Status

Private Public
Build Status Build Status

Maui.sln

SDKS required

Running

IDE

  • If you have Visual Studio 16.9 P4 or newer installed you can open Maui.sln and run it from there.

.NET 6

You can run a Cake target to bootstrap .NET 6 in bin\dotnet and launch Visual Studio:

dotnet tool restore
dotnet cake --target=VS-NET6

NOTES:

  • VS Mac is not yet supported.
  • If the IDE doesn't show any android devices try unloading and reloading the Sample.Droid-net6 project.

You can also run commands individually:

# install local tools required to build (cake, pwsh, etc..)
dotnet tool restore
# Provision .NET 6 in bin\dotnet
dotnet build src\DotNet\DotNet.csproj
# Builds Maui MSBuild tasks
.\bin\dotnet\dotnet build Microsoft.Maui.BuildTasks-net6.sln
# Builds the rest of Maui
.\bin\dotnet\dotnet build Microsoft.Maui-net6.sln
# (Windows-only) to launch Visual Studio
dotnet cake --target=VS-DOGFOOD

To build & run .NET 6 sample apps, you will also need to use .\bin\dotnet\dotnet:

.\bin\dotnet\dotnet build src\Controls\samples\Controls.Sample.Droid\Maui.Controls.Sample.Droid-net6.csproj -t:Run
.\bin\dotnet\dotnet build src\Controls\samples\Controls.Sample.iOS\Maui.Controls.Sample.iOS-net6.csproj -t:Run

Try out a "single project", you will need the -f switch to choose the platform:

.\bin\dotnet\dotnet build src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj -t:Run -f net6.0-android
.\bin\dotnet\dotnet build src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj -t:Run -f net6.0-ios

To build and run Blazor Desktop samples, check out the Blazor Desktop wiki topic.

Current News

May 25, 2021 - Announcing .NET MAUI Preview 4

May 24, 2021 - Azure DevOps Podcast - Interview with David Ortinau

April 21, 2021 - WinUI Community Live Stream

April 21, 2021 - InfoQ Interview with David Ortinau

April 9, 2021 - Announcing .NET Multi-platform App UI Preview 3

April 9, 2021 - Xamarin Podcast - .NET MAUI Q&A

April 6, 2021 - On .NET with guest Maddy Leger - A Journey to .NET MAUI

April 1, 2021 - Xamarin Community Standup with Guest Jonathan Peppers discussing .NET 6 Project System updates

Additional live streams and presentations:

FAQs

Do you have questions? Do not worry, we have prepared a complete FAQ answering the most common questions.

How to Engage, Contribute, and Give Feedback

Some of the best ways to contribute are to try things out, file issues, join in design conversations, and make pull-requests. Proposals for changes specific to MAUI can be found here for discussion.

See CONTRIBUTING

Code of conduct

See CODE-OF-CONDUCT