Skip to content

Commit 970eab4

Browse files
authored
Merge pull request #177 from reactivemarbles/upgrade-to-NET10
Add MAUI hosting extension for generic host
2 parents 3da3306 + 53a4628 commit 970eab4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2004
-125
lines changed

.nuke/build.schema.json

Lines changed: 70 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,49 @@
11
{
22
"$schema": "http://json-schema.org/draft-04/schema#",
3-
"$ref": "#/definitions/build",
4-
"title": "Build Schema",
53
"definitions": {
6-
"build": {
7-
"type": "object",
4+
"Host": {
5+
"type": "string",
6+
"enum": [
7+
"AppVeyor",
8+
"AzurePipelines",
9+
"Bamboo",
10+
"Bitbucket",
11+
"Bitrise",
12+
"GitHubActions",
13+
"GitLab",
14+
"Jenkins",
15+
"Rider",
16+
"SpaceAutomation",
17+
"TeamCity",
18+
"Terminal",
19+
"TravisCI",
20+
"VisualStudio",
21+
"VSCode"
22+
]
23+
},
24+
"ExecutableTarget": {
25+
"type": "string",
26+
"enum": [
27+
"Clean",
28+
"Compile",
29+
"Deploy",
30+
"Pack",
31+
"Print",
32+
"Restore"
33+
]
34+
},
35+
"Verbosity": {
36+
"type": "string",
37+
"description": "",
38+
"enum": [
39+
"Verbose",
40+
"Normal",
41+
"Minimal",
42+
"Quiet"
43+
]
44+
},
45+
"NukeBuild": {
846
"properties": {
9-
"Configuration": {
10-
"type": "string",
11-
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
12-
"enum": [
13-
"Debug",
14-
"Release"
15-
]
16-
},
1747
"Continue": {
1848
"type": "boolean",
1949
"description": "Indicates to continue a previously failed build attempt"
@@ -23,34 +53,13 @@
2353
"description": "Shows the help text for this build assembly"
2454
},
2555
"Host": {
26-
"type": "string",
2756
"description": "Host for execution. Default is 'automatic'",
28-
"enum": [
29-
"AppVeyor",
30-
"AzurePipelines",
31-
"Bamboo",
32-
"Bitbucket",
33-
"Bitrise",
34-
"GitHubActions",
35-
"GitLab",
36-
"Jenkins",
37-
"Rider",
38-
"SpaceAutomation",
39-
"TeamCity",
40-
"Terminal",
41-
"TravisCI",
42-
"VisualStudio",
43-
"VSCode"
44-
]
57+
"$ref": "#/definitions/Host"
4558
},
4659
"NoLogo": {
4760
"type": "boolean",
4861
"description": "Disables displaying the NUKE logo"
4962
},
50-
"NuGetApiKey": {
51-
"type": "string",
52-
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
53-
},
5463
"Partition": {
5564
"type": "string",
5665
"description": "Partition to use on CI"
@@ -74,47 +83,46 @@
7483
"type": "array",
7584
"description": "List of targets to be skipped. Empty list skips all dependencies",
7685
"items": {
77-
"type": "string",
78-
"enum": [
79-
"Clean",
80-
"Compile",
81-
"Deploy",
82-
"Pack",
83-
"Print",
84-
"Restore"
85-
]
86+
"$ref": "#/definitions/ExecutableTarget"
8687
}
8788
},
88-
"Solution": {
89-
"type": "string",
90-
"description": "Path to a solution file that is automatically loaded"
91-
},
9289
"Target": {
9390
"type": "array",
9491
"description": "List of targets to be invoked. Default is '{default_target}'",
9592
"items": {
96-
"type": "string",
97-
"enum": [
98-
"Clean",
99-
"Compile",
100-
"Deploy",
101-
"Pack",
102-
"Print",
103-
"Restore"
104-
]
93+
"$ref": "#/definitions/ExecutableTarget"
10594
}
10695
},
10796
"Verbosity": {
108-
"type": "string",
10997
"description": "Logging verbosity during build execution. Default is 'Normal'",
98+
"$ref": "#/definitions/Verbosity"
99+
}
100+
}
101+
}
102+
},
103+
"allOf": [
104+
{
105+
"properties": {
106+
"Configuration": {
107+
"type": "string",
108+
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
110109
"enum": [
111-
"Minimal",
112-
"Normal",
113-
"Quiet",
114-
"Verbose"
110+
"Debug",
111+
"Release"
115112
]
113+
},
114+
"NuGetApiKey": {
115+
"type": "string",
116+
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
117+
},
118+
"Solution": {
119+
"type": "string",
120+
"description": "Path to a solution file that is automatically loaded"
116121
}
117122
}
123+
},
124+
{
125+
"$ref": "#/definitions/NukeBuild"
118126
}
119-
}
127+
]
120128
}

build/Build.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ partial class Build : NukeBuild
6060

6161
Target Restore => _ => _
6262
.DependsOn(Clean)
63-
.Executes(() => DotNetRestore(s => s.SetProjectFile(Solution)));
63+
.Executes(() =>
64+
{
65+
DotNetWorkloadRestore(s => s.DisableSkipManifestUpdate().SetProject(Solution));
66+
return DotNetRestore(s => s.SetProjectFile(Solution));
67+
});
6468

6569
Target Compile => _ => _
6670
.DependsOn(Restore, Print)

src/Extensions.Hosting.MainUIThread/IUiContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public interface IUiContext
1515
bool IsLifetimeLinked { get; set; }
1616

1717
/// <summary>
18-
/// Gets or sets a value indicating whether is the WPF application started and still running?.
18+
/// Gets or sets a value indicating whether is the application started and still running?.
1919
/// </summary>
2020
bool IsRunning { get; set; }
2121
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:Extensions.Hosting.Maui.Example"
5+
x:Class="Extensions.Hosting.Maui.Example.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
10+
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
</Application>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
namespace Extensions.Hosting.Maui.Example;
6+
7+
/// <summary>
8+
/// App.
9+
/// </summary>
10+
/// <seealso cref="Microsoft.Maui.Controls.Application" />
11+
public partial class App : Application
12+
{
13+
/// <summary>
14+
/// Initializes a new instance of the <see cref="App"/> class.
15+
/// </summary>
16+
public App()
17+
{
18+
InitializeComponent();
19+
20+
// Start the host
21+
MauiProgram.HostApp.StartAsync();
22+
}
23+
24+
/// <summary>
25+
/// Creates the window.
26+
/// </summary>
27+
/// <param name="activationState">State of the activation.</param>
28+
/// <returns>A Window.</returns>
29+
protected override Window CreateWindow(IActivationState? activationState) => new(new AppShell());
30+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="Extensions.Hosting.Maui.Example.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:Extensions.Hosting.Maui.Example"
7+
Title="Extensions.Hosting.Maui.Example">
8+
9+
<ShellContent
10+
Title="Home"
11+
ContentTemplate="{DataTemplate local:MainPage}"
12+
Route="MainPage" />
13+
14+
</Shell>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
namespace Extensions.Hosting.Maui.Example;
6+
7+
/// <summary>
8+
/// AppShell.
9+
/// </summary>
10+
/// <seealso cref="Shell" />
11+
public partial class AppShell : Shell
12+
{
13+
/// <summary>
14+
/// Initializes a new instance of the <see cref="AppShell"/> class.
15+
/// </summary>
16+
public AppShell() => InitializeComponent();
17+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using ReactiveMarbles.Extensions.Hosting.Maui;
6+
7+
namespace Extensions.Hosting.Maui.Example;
8+
9+
/// <summary>
10+
/// Example MAUI service.
11+
/// </summary>
12+
public class ExampleMauiService : IMauiService
13+
{
14+
/// <summary>
15+
/// Initializes the specified application.
16+
/// </summary>
17+
/// <param name="application">The application.</param>
18+
public void Initialize(Microsoft.Maui.Controls.Application application)
19+
{
20+
// Example initialization
21+
Console.WriteLine("MAUI application initialized via IMauiService");
22+
}
23+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<IsPackable>false</IsPackable>
5+
<TargetFrameworks>net9.0-android;</TargetFrameworks>
6+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
7+
8+
<!-- Note for MacCatalyst:
9+
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
10+
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
11+
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
12+
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
13+
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
14+
15+
<OutputType>Exe</OutputType>
16+
<RootNamespace>Extensions.Hosting.Maui.Example</RootNamespace>
17+
<UseMaui>true</UseMaui>
18+
<SingleProject>true</SingleProject>
19+
<ImplicitUsings>enable</ImplicitUsings>
20+
<Nullable>enable</Nullable>
21+
22+
<!-- Display name -->
23+
<ApplicationTitle>Extensions.Hosting.Maui.Example</ApplicationTitle>
24+
25+
<!-- App Identifier -->
26+
<ApplicationId>com.companyname.extensions.hosting.maui.example</ApplicationId>
27+
28+
<!-- Versions -->
29+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
30+
<ApplicationVersion>1</ApplicationVersion>
31+
32+
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
33+
<WindowsPackageType>None</WindowsPackageType>
34+
35+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
36+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
37+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
38+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
39+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
40+
<NoWarn>NU1605;SA1633;SA1600;SA1601;SA1027;SA1137;SX1309;CA1805;CA1400;RCS1102;SA1400;SA1508;SA1512;SA1642;SX1101</NoWarn>
41+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
42+
</PropertyGroup>
43+
44+
<ItemGroup>
45+
<!-- App Icon -->
46+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
47+
48+
<!-- Splash Screen -->
49+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
50+
51+
<!-- Images -->
52+
<MauiImage Include="Resources\Images\*" />
53+
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
54+
55+
<!-- Custom Fonts -->
56+
<MauiFont Include="Resources\Fonts\*" />
57+
58+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
59+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
60+
</ItemGroup>
61+
62+
<ItemGroup>
63+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
64+
<PackageReference Include="Microsoft.Maui.Essentials" Version="$(MauiVersion)" />
65+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
66+
</ItemGroup>
67+
68+
<ItemGroup>
69+
<ProjectReference Include="..\Extensions.Hosting.Maui\Extensions.Hosting.Maui.csproj" />
70+
</ItemGroup>
71+
72+
<ItemGroup>
73+
<None Update="SecondPage.xaml">
74+
<Generator>MSBuild:Compile</Generator>
75+
</None>
76+
</ItemGroup>
77+
78+
</Project>

0 commit comments

Comments
 (0)