NOTE: now implemented at dotnet/maui#603
Prototype of a dotnet/maui "workload". Go to dotnet/maui if you are looking for Maui itself.
Explanation of projects:
DotNet.Toolchain
- creates a .NET 6 installation inbin
Maui.Dependencies
- installs the Android/iOS workloads & SDK packsMicrosoft.NET.Workload.Maui
- configures Maui as a "workload"Microsoft.Maui.Sdk
- Maui's SDK pack
This prototype, enables 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>
This automatically brings in:
Microsoft.NET.Workload.Maui
Microsoft.Maui.Sdk
Where the SDK sets up Microsoft.Maui in a .NET 6 project.
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 configurationWorkloadManifest.targets
- importsMicrosoft.Maui.Sdk
when$(UseMaui)
istrue
. 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:
To build this repo:
dotnet build
This creates the output structure:
bin/
dotnet-install.sh|ps1
*.nupkg
- any NuGet packages*.binlog
- any build logsdotnet/
dotnet(.exe)
sdk-manifests/
6.0.100/
Microsoft.NET.Workload.Android
Microsoft.NET.Workload.iOS
Microsoft.NET.Workload.Maui
packs
Microsoft.Android.Ref
Microsoft.Android.Sdk.host-rid
Microsoft.iOS.Ref
Microsoft.iOS.Sdk
Microsoft.Maui.Sdk
Next, you can build the samples
using the local dotnet
:
./bin/dotnet/dotnet build samples/samples.sln
Currently, you can use Visual Studio 2019 16.9 on Windows (with the Xamarin workload) with a few manual steps.
This is the same setup instructions from the net6-mobile-samples.
Open an Administrator command prompt to enable the
EnableWorkloadResolver.sentinel
feature flag:
> cd "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver"
> echo > EnableWorkloadResolver.sentinel
Or in an Administrator powershell
prompt:
> cd "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver"
> '' > EnableWorkloadResolver.sentinel
NOTE: your path to Visual Studio may vary, depending on where you selected to install it.
Enterprise
,Professional
, orCommunity
might be correct depending on the SKU you have installed.
This command creates an empty file that enables .NET workload support. Restart Visual Studio after making this change.
Restart Visual Studio after making this change.
If you just opened samples/samples.sln
yourself, it would use your
system dotnet
install such as %ProgramFiles%\dotnet\
or
/usr/local/share/dotnet/
.
Instead, use this script at a powershell prompt:
.\scripts\dogfood.ps1
By default this launches C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe
with environment
variables configured to use the local ./bin/dotnet
folder.
You can configure the path to VS with:
.\scripts\dogfood.ps1 -vs "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe"
Or open a different .sln
file:
.\scripts\dogfood.ps1 -sln .\path\to\YourSolution.sln