Skip to content

Commit

Permalink
Add the multi-project template
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Feb 6, 2024
1 parent a6c9997 commit 4402b94
Show file tree
Hide file tree
Showing 122 changed files with 1,996 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"Framework": {
"longName": "framework"
},
"android": {
"shortName": ""
},
"ios": {
"shortName": ""
},
"maccatalyst": {
"longName": "macos",
"shortName": ""
},
"winui": {
"longName": "windows",
"shortName": ""
}
},
"usageExamples": [
"--framework DOTNET_TFM_VALUE --android --ios"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "http://json.schemastore.org/ide.host",
"icon": "ide/icon.ico",
"unsupportedHosts": [
{
"id": "vs",
"version": "(,17.3)"
}
],
"requiredComponents": [
{
"id": "Microsoft.VisualStudio.ComponentGroup.Maui.All",
"hostId": "vs",
"componentType": "SetupComponent"
}
],
"symbolInfo": [
{
"id": "Framework",
"persistenceScope": "shared",
"persistenceScopeName": "maui"
},
{
"id": "android",
"isVisible": true,
"defaultValue": "true"
},
{
"id": "ios",
"isVisible": true,
"defaultValue": "true"
},
{
"id": "maccatalyst",
"isVisible": true,
"defaultValue": "true"
},
{
"id": "winui",
"isVisible": true,
"defaultValue": "true"
}
]
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "Microsoft",
"classifications": [ "MAUI", "Android", "iOS", "macOS", "Mac Catalyst", "Windows", "Tizen", "Mobile" ],
"identity": "Microsoft.Maui.MultiProjectApp.CSharp.DOTNET_TFM_VERSION_VALUE",
"groupIdentity": "Microsoft.Maui.MultiProjectApp",
"precedence": "DOTNET_TFM_VERSION_MAJOR_VALUE",
"name": ".NET MAUI Multi-Project App",
"description": "A project for creating a .NET MAUI application for iOS, Android, Mac Catalyst, WinUI and Tizen with multiple, separate app projects.",
"shortName": "maui-multiproject",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "MauiApp.1",
"primaryOutputs": [
{
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
"path": "MauiApp.1/MainPage.xaml.cs"
},
{
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
"path": "MauiApp.1/MainPage.xaml"
}
],
"postActions": [
{
"id": "openInEditor",
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\" && HostIdentifier != \"vs\")",
"description": "Opens MainPage.xaml in the editor.",
"manualInstructions": [],
"actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
"args": {
"files": "0;1"
},
"continueOnError": true
}
],
"sources": [
{
"source": "./",
"target": "./",
"copyOnly": [ "**/*.svg", "**/*.ttf" ],
"modifiers": [
{
"condition": "(!android && !AllPlatforms)",
"exclude": [
"MauiApp.1.Droid/**/*"
]
},
{
"condition": "(!ios && !AllPlatforms)",
"exclude": [
"MauiApp.1.iOS/**/*"
]
},
{
"condition": "(!maccatalyst && !AllPlatforms)",
"exclude": [
"MauiApp.1.Mac/**/*"
]
},
{
"condition": "(!winui && !AllPlatforms)",
"exclude": [
"MauiApp.1.WinUI/**/*"
]
}
]
}
],
"preferNameDirectory": true,
"guids": [
"87919f9c-abb8-48e5-bae7-eb1b4140f6a8"
],
"symbols": {
"applicationId": {
"type": "parameter",
"description": "Overrides the $(ApplicationId) in the project",
"datatype": "string"
},
"msExtensionsLoggingDebugVersion": {
"type": "parameter",
"dataType": "string",
"replaces": "MS_EXT_LOG_DEBUG_VERSION",
"defaultValue": "MS_EXT_LOG_DEBUG_VERSION_VALUE"
},
"Framework": {
"type": "parameter",
"description": "The target framework for the project.",
"datatype": "choice",
"choices": [
{
"choice": "DOTNET_TFM_VALUE",
"description": "Target DOTNET_TFM_VALUE"
}
],
"replaces": "DOTNET_TFM",
"defaultValue": "DOTNET_TFM_VALUE"
},
"android": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"defaultIfOptionWithoutValue": "true",
"displayName": "Android",
"description": "Include the Android app head project"
},
"ios": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"defaultIfOptionWithoutValue": "true",
"displayName": "iOS",
"description": "Include the iOS app head project"
},
"maccatalyst": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"defaultIfOptionWithoutValue": "true",
"displayName": "macOS using Mac Catalyst",
"description": "Include the macOS app head project (using Mac Catalyst)"
},
"winui": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"defaultIfOptionWithoutValue": "true",
"displayName": "Windows using WinUI 3",
"description": "Include the Windows app head project (using WinUI 3)"
},
"AllPlatforms": {
"type": "computed",
"value": "(!android && !ios && !maccatalyst && !winui)"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
},
"PhoneProductId": {
"type": "generated",
"generator": "guid",
"replaces": "$guid9$"
},
"nameToLower":{
"type": "generated",
"generator": "casing",
"parameters": {
"source" : "name",
"toLower": true
}
},
"nameToAppId": {
"type": "generated",
"generator": "regex",
"dataType": "string",
"parameters": {
"source": "nameToLower",
"steps": [
{
"regex": "[^a-z0-9_\\.]",
"replacement": ""
}
]
}
},
"defaultAppId":{
"type": "generated",
"generator": "join",
"parameters": {
"symbols": [
{
"type": "const",
"value": "com.companyname."
},
{
"type": "ref",
"value": "nameToAppId"
}
]
}
},
"finalAppId":{
"type":"generated",
"generator": "coalesce",
"parameters": {
"sourceVariableName": "applicationId",
"fallbackVariableName": "defaultAppId"
},
"replaces": "com.companyname.mauiapp"
}
},
"defaultName": "MauiApp1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.companyname.mauiapp" android:versionCode="1" android:versionName="1.0">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:label="@string/app_name" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".

These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:

public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

InputStream input = Assets.Open ("my_asset.txt");
}
}

Additionally, some Android functions will automatically load asset files:

Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace MauiApp._1.Droid;

[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Android.App;
using Android.Runtime;

namespace MauiApp._1.Droid;

[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0-android</TargetFramework>
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseMaui>true</UseMaui>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="MS_EXT_LOG_DEBUG_VERSION" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MauiApp.1\MauiApp.1.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace MauiApp._1.Droid;

public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();

builder
.UseSharedMauiApp();

return builder.Build();
}
}
Loading

0 comments on commit 4402b94

Please sign in to comment.