Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Setup Maui.sln with a set of net6 projects #13433

Merged
merged 35 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d39199e
net6 projects
PureWeen Oct 30, 2020
e9272d7
- additional
PureWeen Oct 30, 2020
f9cd373
- net6 nullable fixes
PureWeen Oct 30, 2020
60c60cd
- provision sdks
PureWeen Jan 17, 2021
a914ea6
- net6.0
PureWeen Jan 17, 2021
c1d3017
- change to 5.0.0
PureWeen Jan 17, 2021
61105aa
- update cake provisioning
PureWeen Jan 19, 2021
2ee51b7
- net6 fixes
PureWeen Feb 1, 2021
111e501
- fix up platform heads
PureWeen Feb 1, 2021
c428892
- fix global.json
PureWeen Feb 1, 2021
b4d679d
- add net6 nuget feeds
PureWeen Feb 1, 2021
35d909c
- fix up platform heads and net6 if defs
PureWeen Feb 1, 2021
0b00b2c
- simplify
PureWeen Feb 1, 2021
1fe92ce
- add dotnet core build of maui sln
PureWeen Feb 1, 2021
caea497
- update readme
PureWeen Feb 1, 2021
75fd857
- net6 yaml target
PureWeen Feb 2, 2021
9eb6007
- remove net6 build from nuget
PureWeen Feb 2, 2021
1a84596
- simplify provisioning
PureWeen Feb 2, 2021
905ef62
- write json file
PureWeen Feb 2, 2021
6319bda
- net6 via yaml
PureWeen Feb 2, 2021
2ec2520
- fix parameters
PureWeen Feb 2, 2021
e43d68a
- more boots
PureWeen Feb 2, 2021
391b707
- yaml
PureWeen Feb 2, 2021
3c76d75
- base yaml pipeline off net6-samples
PureWeen Feb 2, 2021
5f2cfee
- yaml yaml yaml
PureWeen Feb 2, 2021
b67949b
- mac yaml
PureWeen Feb 2, 2021
0917e6a
- add binlogs
PureWeen Feb 2, 2021
ac5e63e
- set AndroidRestoreOnBuild to false
PureWeen Feb 2, 2021
d46d687
- browser assembly
PureWeen Feb 2, 2021
3598819
- fix artifacts directories
PureWeen Feb 2, 2021
b31b66f
- fix NET6 artifacts
PureWeen Feb 2, 2021
90e479a
- update to preview bits
PureWeen Feb 4, 2021
db030e9
Update handlers.yml
PureWeen Feb 10, 2021
34add85
[Build]Deploy android sample app
rmarinho Feb 10, 2021
e9f81f9
- restore from devops config
PureWeen Feb 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions .nuspec/Xamarin.Forms.MultiTargeting.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true ">
<Compile Remove="**\*.iOS.cs" />
<None Include="**\*.iOS.cs" />
<Compile Remove="**\iOS\*.cs" />
Expand All @@ -11,13 +11,13 @@
<Compile Remove="**\Mac\*.cs" />
<None Include="**\Mac\*.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true And $(TargetFramework.StartsWith('Xamarin.iOS')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true ">
<Compile Remove="**\*.MaciOS.cs" />
<None Include="**\*.MaciOS.cs" />
<Compile Remove="**\MaciOS\*.cs" />
<None Include="**\MaciOS\*.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) != true AND $(TargetFramework.StartsWith('net6.0-android')) != true ">
<Compile Remove="**\*.Android.cs" />
<None Include="**\*.Android.cs" />
<Compile Remove="**\Android\*.cs" />
Expand All @@ -40,16 +40,36 @@
<None Include="**\Win32\*.cs" />
</ItemGroup>


<!-- Android -->
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-android'))">
<DefineConstants>$(DefineConstants);MONOANDROID</DefineConstants>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use the ANDROID define instead, it is there by default in .NET 6.

</PropertyGroup>

<!-- iOS -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0-ios' ">
<DefineConstants>$(DefineConstants);IOS</DefineConstants>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be defined by default in .NET 6. Is it not?

</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework.StartsWith('netcoreapp')) == true ">
<UseWpf>true</UseWpf>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<!-- If this becomes part of the product we will remove these but for now it's useful having them all in one place -->
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) == true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) == true OR '$(TargetPlatformIdentifier)' == 'android' OR '$(TargetFramework)' == 'net6.0-android'">
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.2.0.4" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.6" />
</ItemGroup>
</Project>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net5.0-windows')) == true">
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<DefineConstants>$(DefineConstants);DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;UWP_16299;UWP_18362;UWP_17134</DefineConstants>
<NoWarn>$(NoWarn);NU5104</NoWarn>
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net5.0-windows')) == true">
<PackageReference Include="Microsoft.WinUI" Version="3.0.0-preview3.201113.0" />
</ItemGroup>
</Project>
56 changes: 56 additions & 0 deletions Maui.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30926.220
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Platform.Handlers-net6", "src\Platform.Handlers\src\Xamarin.Platform.Handlers\Xamarin.Platform.Handlers-net6.csproj", "{95BA42B5-B00E-4986-B9B5-517140378452}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample-net6", "src\Platform.Handlers\samples\Sample\Sample-net6.csproj", "{31D405F0-723E-4A6C-A52B-F4CB19A8D845}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files", "Files", "{449F6071-A74F-4309-8D7B-7038CFD1B17B}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
.nuspec\Xamarin.Forms.MultiTargeting.targets = .nuspec\Xamarin.Forms.MultiTargeting.targets
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.Core-net6", "src\Forms\src\Xamarin.Forms.Core\Xamarin.Forms.Core-net6.csproj", "{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Droid-net6", "src\Platform.Handlers\samples\Sample.Droid\Sample.Droid-net6.csproj", "{3AE5B968-1916-4213-97E4-F88F51BCAB23}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.iOS-net6", "src\Platform.Handlers\samples\Sample.iOS\Sample.iOS-net6.csproj", "{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{95BA42B5-B00E-4986-B9B5-517140378452}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95BA42B5-B00E-4986-B9B5-517140378452}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95BA42B5-B00E-4986-B9B5-517140378452}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95BA42B5-B00E-4986-B9B5-517140378452}.Release|Any CPU.Build.0 = Release|Any CPU
{31D405F0-723E-4A6C-A52B-F4CB19A8D845}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31D405F0-723E-4A6C-A52B-F4CB19A8D845}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31D405F0-723E-4A6C-A52B-F4CB19A8D845}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31D405F0-723E-4A6C-A52B-F4CB19A8D845}.Release|Any CPU.Build.0 = Release|Any CPU
{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}.Release|Any CPU.Build.0 = Release|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Release|Any CPU.Build.0 = Release|Any CPU
{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50}
EndGlobalSection
EndGlobal
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@
* Evolution of [Xamarin.Forms](https://github.com/xamarin/xamarin.forms)
* Targeting .NET 6, previews end of year

## Maui.sln

### SDKS required
- Install the SDKs listed here https://github.com/xamarin/net6-samples
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We moved the repo to dotnet/net6-mobile-samples


- And/or run the following

```
dotnet tool install Cake.Tool -g
dotnet cake --target=provision
```

### Running

#### IDE
- If you have Visual Studio 16.9 P4 installed you can open `Maui.sln` and run it from there.

#### Command Line

```
dotnet build src\Platform.Handlers\samples\Sample.Droid\Sample.Droid-net6.csproj -t:Run
dotnet build src\Platform.Handlers\samples\Sample.iOS\Sample.iOS-net6.csproj -t:Run
```

## Current News

[![](Assets/poster-standup.png)](https://www.youtube.com/watch?v=5bK2ICHtMxo)
Expand Down
104 changes: 63 additions & 41 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PowerShell:
#addin "nuget:?package=Cake.Android.Adb&version=3.2.0"
#addin "nuget:?package=Cake.Git&version=0.21.0"
#addin "nuget:?package=Cake.Android.SdkManager&version=3.0.2"
#addin "nuget:?package=Cake.Boots&version=1.0.2.437"
#addin "nuget:?package=Cake.Boots&version=1.0.3.556"
#addin "nuget:?package=Cake.AppleSimulator&version=0.2.0"
#addin "nuget:?package=Cake.FileHelpers&version=3.2.1"

Expand Down Expand Up @@ -388,7 +388,7 @@ Task("provision-netsdk-local")

Information("Downloading: {0} to {1}", cabUrl, cabPath);
DownloadFile(cabUrl, cabPath);
InstallMsi(msiUrl, null, msiName);
InstallMsiOrExe(msiUrl, null, msiName);
}

int i = 0;
Expand Down Expand Up @@ -541,7 +541,7 @@ Task("provision-uitests-uwp")
if(!DirectoryExists(driverPath))
{
try{
InstallMsi(UWP_APP_DRIVER_INSTALL_PATH, installPath);
InstallMsiOrExe(UWP_APP_DRIVER_INSTALL_PATH, installPath);
}
catch(Exception e)
{
Expand All @@ -550,31 +550,77 @@ Task("provision-uitests-uwp")
}
});

void InstallMsi(string msiFile, string installTo, string fileName = "InstallFile.msi")

async Task InstallMsiWithBoots(string msiFile, string installTo = null, string fileName = "InstallFile.msi")
{
bool success = false;

try
{
await Boots(msiFile);
success = true;
}
catch (System.Exception e)
{
Information("Boots failed: {0}", e);
}


if(success)
return;

try
{
InstallMsiOrExe(msiFile, installTo, fileName, !isCIBuild);
success = true;
}
catch (System.Exception e)
{
Information("Our attempt failed: {0}", e);
}
}

void InstallMsiOrExe(string msiFile, string installTo = null, string fileName = "InstallFile.msi", bool interactive = false)
{
if(msiFile.EndsWith(".exe") && fileName == "InstallFile.msi")
fileName = "InstallFile.exe";

string installerPath = $"{System.IO.Path.GetTempPath()}{fileName}";

try
{
Information ("Installing: {0}", msiFile);
DownloadFile(msiFile, installerPath);
Information("File Downloaded To: {0}", installerPath);
int result = -1;

var argumentBuilder =
new ProcessArgumentBuilder()
.Append("/a")
.Append(installerPath)
.Append("/qn");

if(!String.IsNullOrWhiteSpace(installTo))
if(msiFile.EndsWith(".exe"))
{
Information("Installing into: {0}", installTo);
argumentBuilder = argumentBuilder.Append("TARGETDIR=\"" + installTo + "\"");
result = StartProcess(installerPath, new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append(@" /q")
}
);
}
else{
var argumentBuilder =
new ProcessArgumentBuilder()
.Append("/a")
.Append(installerPath);

if(!interactive)
argumentBuilder = argumentBuilder.Append("/qn");

var result = StartProcess("msiexec", new ProcessSettings {
Arguments = argumentBuilder
});
if(!String.IsNullOrWhiteSpace(installTo))
{
Information("Installing into: {0}", installTo);
argumentBuilder = argumentBuilder.Append("TARGETDIR=\"" + installTo + "\"");
}

result = StartProcess("msiexec", new ProcessSettings {
Arguments = argumentBuilder
});
}

if(result != 0)
throw new Exception("Failed to install: " + msiFile);
Expand Down Expand Up @@ -828,30 +874,6 @@ Task("BuildForNuget")
}
});

Task("BuildPages")
.IsDependentOn("BuildTasks")
.Description("Build Xamarin.Forms.Pages")
.Does(() =>
{
try
{
var msbuildSettings = GetMSBuildSettings();
var binaryLogger = new MSBuildBinaryLogSettings {
Enabled = isCIBuild
};

msbuildSettings.BinaryLogger = binaryLogger;
binaryLogger.FileName = $"{artifactStagingDirectory}/win-pages-{configuration}.binlog";
MSBuild("./build/Xamarin.Forms.Pages.sln", msbuildSettings.WithRestore());

}
catch(Exception)
{
if(IsRunningOnWindows())
throw;
}
});

Task("BuildTasks")
.Description($"Build {BUILD_TASKS_PROJ}")
.Does(() =>
Expand Down Expand Up @@ -891,7 +913,7 @@ Task("VSMAC")
{
StartVisualStudio();
});

Task("cg-android")
.Description("Builds Android Control Gallery")
.IsDependentOn("WriteGoogleMapsAPIKey")
Expand Down
1 change: 1 addition & 0 deletions eng/DevopsNuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="xamarin" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
Expand Down
2 changes: 1 addition & 1 deletion eng/Environment.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<!-- Auto install any missing Android SDKs -->
<PropertyGroup Condition="'$(CI)' == 'true'">
<AndroidRestoreOnBuild Condition="'$(AndroidRestoreOnBuild)' == ''">True</AndroidRestoreOnBuild>
<AndroidRestoreOnBuild Condition="'$(AndroidRestoreOnBuild)' == ''">False</AndroidRestoreOnBuild>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property currently doesn't work with NET6

<AcceptAndroidSDKLicenses Condition="'$(AcceptAndroidSDKLicenses)' == ''">True</AcceptAndroidSDKLicenses>
</PropertyGroup>
</Project>
Loading