From d1a9dfdcc358cc6084403488f755a331b582afe3 Mon Sep 17 00:00:00 2001
From: Vijay Anand E G <81947404+egvijayanand@users.noreply.github.com>
Date: Tue, 7 Feb 2023 02:59:52 +0530
Subject: [PATCH 1/2] Updated version of MauiTemplates CLI package
---
.../MauiAppX/MauiApp.1.csproj | 2 +-
.../MauiClassLib/MauiClassLib.1.csproj | 2 +-
.../.template.config/dotnetcli.host.json | 8 ++++
.../MyClass/.template.config/ide.host.json | 3 ++
.../MyClass/.template.config/template.json | 43 +++++++++++++++++++
src/MauiTemplatesCLI/MyClass/MyClass.1.cs | 10 +++++
src/MauiTemplatesCLI/PackageVersion.txt | 2 +-
.../SharedClassLib/SharedClassLib.1.csproj | 2 +-
.../VijayAnand.MauiTemplates.csproj | 2 +-
src/MauiTemplatesCLI/overview.md | 24 ++++++++---
src/MauiTemplatesCLI/release-notes.txt | 18 +++++++-
11 files changed, 104 insertions(+), 12 deletions(-)
create mode 100644 src/MauiTemplatesCLI/MyClass/.template.config/dotnetcli.host.json
create mode 100644 src/MauiTemplatesCLI/MyClass/.template.config/ide.host.json
create mode 100644 src/MauiTemplatesCLI/MyClass/.template.config/template.json
create mode 100644 src/MauiTemplatesCLI/MyClass/MyClass.1.cs
diff --git a/src/MauiTemplatesCLI/MauiAppX/MauiApp.1.csproj b/src/MauiTemplatesCLI/MauiAppX/MauiApp.1.csproj
index d0d4bbf..ba86e8c 100644
--- a/src/MauiTemplatesCLI/MauiAppX/MauiApp.1.csproj
+++ b/src/MauiTemplatesCLI/MauiAppX/MauiApp.1.csproj
@@ -106,7 +106,7 @@
-
+
diff --git a/src/MauiTemplatesCLI/MauiClassLib/MauiClassLib.1.csproj b/src/MauiTemplatesCLI/MauiClassLib/MauiClassLib.1.csproj
index b888e9e..32a7d8b 100644
--- a/src/MauiTemplatesCLI/MauiClassLib/MauiClassLib.1.csproj
+++ b/src/MauiTemplatesCLI/MauiClassLib/MauiClassLib.1.csproj
@@ -40,7 +40,7 @@
-
+
diff --git a/src/MauiTemplatesCLI/MyClass/.template.config/dotnetcli.host.json b/src/MauiTemplatesCLI/MyClass/.template.config/dotnetcli.host.json
new file mode 100644
index 0000000..8c438fd
--- /dev/null
+++ b/src/MauiTemplatesCLI/MyClass/.template.config/dotnetcli.host.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "http://json.schemastore.org/dotnetcli.host",
+ "symbolInfo": {
+ "namespace": {
+ "shortName": "na"
+ }
+ }
+}
diff --git a/src/MauiTemplatesCLI/MyClass/.template.config/ide.host.json b/src/MauiTemplatesCLI/MyClass/.template.config/ide.host.json
new file mode 100644
index 0000000..348ae09
--- /dev/null
+++ b/src/MauiTemplatesCLI/MyClass/.template.config/ide.host.json
@@ -0,0 +1,3 @@
+{
+ "$schema": "http://json.schemastore.org/vs-2017.3.host"
+}
diff --git a/src/MauiTemplatesCLI/MyClass/.template.config/template.json b/src/MauiTemplatesCLI/MyClass/.template.config/template.json
new file mode 100644
index 0000000..b24daed
--- /dev/null
+++ b/src/MauiTemplatesCLI/MyClass/.template.config/template.json
@@ -0,0 +1,43 @@
+{
+ "$schema": "https://json.schemastore.org/template",
+ "author": "Vijay Anand E G",
+ "defaultName": "Class1",
+ "classifications": [
+ "Code"
+ ],
+ "identity": "VijayAnand.MyClass",
+ "groupIdentity": "VijayAnand.MauiTemplates.Class.Code",
+ "description": "An item template for Partial Class in C#",
+ "name": "Partial Class",
+ "shortName": "class",
+ "sourceName": "MyClass.1",
+ "primaryOutputs": [
+ {
+ "path": "MyClass.1.cs"
+ }
+ ],
+ "tags": {
+ "language": "C#",
+ "type": "item"
+ },
+ "symbols": {
+ "namespace": {
+ "type": "bind",
+ "binding": "msbuild:RootNamespace",
+ "replaces": "MyApp.Namespace",
+ "defaultValue": "MyApp.Namespace"
+ }
+ },
+ "constraints": {
+ "dotnet7-sts": {
+ "type": "sdk-version",
+ "args": [
+ "[7.0,)"
+ ]
+ },
+ "csharp-only": {
+ "type": "project-capability",
+ "args": "CSharp"
+ }
+ }
+}
diff --git a/src/MauiTemplatesCLI/MyClass/MyClass.1.cs b/src/MauiTemplatesCLI/MyClass/MyClass.1.cs
new file mode 100644
index 0000000..8cd2770
--- /dev/null
+++ b/src/MauiTemplatesCLI/MyClass/MyClass.1.cs
@@ -0,0 +1,10 @@
+namespace MyApp.Namespace
+{
+ public partial class MyClass__1
+ {
+ public MyClass__1()
+ {
+
+ }
+ }
+}
diff --git a/src/MauiTemplatesCLI/PackageVersion.txt b/src/MauiTemplatesCLI/PackageVersion.txt
index 2bf1c1c..197c4d5 100644
--- a/src/MauiTemplatesCLI/PackageVersion.txt
+++ b/src/MauiTemplatesCLI/PackageVersion.txt
@@ -1 +1 @@
-2.3.1
+2.4.0
diff --git a/src/MauiTemplatesCLI/SharedClassLib/SharedClassLib.1.csproj b/src/MauiTemplatesCLI/SharedClassLib/SharedClassLib.1.csproj
index 6938a9b..5bd7fe0 100644
--- a/src/MauiTemplatesCLI/SharedClassLib/SharedClassLib.1.csproj
+++ b/src/MauiTemplatesCLI/SharedClassLib/SharedClassLib.1.csproj
@@ -56,7 +56,7 @@
-
+
diff --git a/src/MauiTemplatesCLI/VijayAnand.MauiTemplates.csproj b/src/MauiTemplatesCLI/VijayAnand.MauiTemplates.csproj
index c4a35d3..10c7551 100644
--- a/src/MauiTemplatesCLI/VijayAnand.MauiTemplates.csproj
+++ b/src/MauiTemplatesCLI/VijayAnand.MauiTemplates.csproj
@@ -28,7 +28,7 @@
true
-
diff --git a/src/MauiTemplatesCLI/overview.md b/src/MauiTemplatesCLI/overview.md
index a548d91..94ef67d 100644
--- a/src/MauiTemplatesCLI/overview.md
+++ b/src/MauiTemplatesCLI/overview.md
@@ -14,8 +14,9 @@ Item templates for the following:
|ContentView (C#)|maui-view-cs|
|ResourceDictionary (XAML)|maui-resdict|
|Shell (XAML)|maui-shell|
+|Partial Class (C#)|class|
-All of these templates currently target `.NET MAUI on .NET 7 GA`, stable release as of Nov 2022.
+All of these templates currently target `.NET MAUI on .NET 6/7 GA and its Service Releases`.
Install the template package from NuGet with the below command.
@@ -85,12 +86,13 @@ The target for the Windows platform can be either `Package` (MSIX) or `Unpackage
* `-wu` | `--windows-unpackaged` - Default is `false`
-While targeting `.NET 7`, an option to add and configure `Microsoft.Maui.Controls.Foldable`, `Microsoft.Maui.Controls.Maps`, or both NuGet packages.
+While targeting `.NET 7`, an option to add and configure `CommunityToolkit.Maui.MediaElement`, `Microsoft.Maui.Controls.Foldable`, `Microsoft.Maui.Controls.Maps`, or all NuGet packages.
+* `-ime` | `--include-media-element` - Default is `false`
* `-if` | `--include-foldable` - Default is `false`
* `-inm` | `--include-maps` - Default is `false`
-*Note: If the project target `.NET 6`, selecting the Foldable/Maps option will NOT have any impact.*
+*Note: If the project target `.NET 6`, selecting the MediaElement/Foldable/Maps option will NOT have any impact.*
##### Conditional Compilation
@@ -163,7 +165,7 @@ Can take any one of the following values, with default value set to `Plain`:
* `-tp` | `--target-platform`
-Can take any one of the following values, with default value set to `All`:
+Can take a combination of the following values, with default value set to `All`:
|Parameter Value|Description|
|:---:|:---|
@@ -235,7 +237,7 @@ dotnet new mauiapp -n MyApp -dp Hybrid
```
Option to include NuGet packages:
```shell
-dotnet new mauiapp -n MyApp -dp Shell -it -im -imt -inm -if
+dotnet new mauiapp -n MyApp -dp Shell -it -im -imt -ime -inm -if
```
Option to configure conditional compilation:
```shell
@@ -290,6 +292,11 @@ Resource Dictionary:
dotnet new maui-resdict -n LightTheme -na MyApp.Themes
```
+Partial Class:
+```shell
+dotnet new class -n BaseViewModel
+```
+
With parameter names expanded:
.NET MAUI App:
@@ -298,7 +305,7 @@ dotnet new mauiapp --name MyApp --design-pattern Hybrid
```
Option to include NuGet packages:
```shell
-dotnet new mauiapp --name MyApp --design-pattern Shell --include-toolkit --include-markup --include-mvvm-toolkit --include-maps --include-foldable
+dotnet new mauiapp --name MyApp --design-pattern Shell --include-toolkit --include-markup --include-mvvm-toolkit --include-media-element --include-maps --include-foldable
```
```shell
dotnet new mauiapp -n MyApp --design-pattern Shell --conditional-compilation
@@ -348,3 +355,8 @@ Resource Dictionary:
```shell
dotnet new maui-resdict --name LightTheme --namespace MyApp.Themes
```
+
+Partial Class:
+```shell
+dotnet new class --name BaseViewModel
+```
diff --git a/src/MauiTemplatesCLI/release-notes.txt b/src/MauiTemplatesCLI/release-notes.txt
index 8721438..bc4b309 100644
--- a/src/MauiTemplatesCLI/release-notes.txt
+++ b/src/MauiTemplatesCLI/release-notes.txt
@@ -1,5 +1,21 @@
-What's new in ver. 2.3.1:
+What's new in ver. 2.4.0:
-------------------------
+1. CommunityToolkit.Maui.Markup NuGet package bumped to v3.0.0 that supports TypedBindings
+
+2. Introduced a new item template for creating a C# class (partial) from CLI
+
+dotnet new class -n BaseViewModel
+
+Note:
+
+Auto binding the project's RootNamespace as the namespace for newly created class type is supported only on .NET 7 SDK or later.
+
+While running on earlier SDK versions, it has to be manually modified.
+
+And due to the limitation in the templating engine, only the RootNamespace would get added, need to manually adjust for sub-folders, if any.
+
+v2.3.1:
+
CommunityToolkit.Maui.MediaElement NuGet package bumped to v1.0.1 with the explicit WindowsAppSDK reference removed.
v2.3.0:
From 532eeff113f0622ab41a2106aab5849e819481a7 Mon Sep 17 00:00:00 2001
From: Vijay Anand E G <81947404+egvijayanand@users.noreply.github.com>
Date: Tue, 7 Feb 2023 03:06:29 +0530
Subject: [PATCH 2/2] Docs update
---
README.md | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/README.md b/README.md
index 3d72c1b..e57a25a 100644
--- a/README.md
+++ b/README.md
@@ -107,6 +107,7 @@ ContentView | maui-view | Item
ContentView (C#) | maui-view-cs | Item
ResourceDictionary | maui-resdict | Item
ShellPage | maui-shell | Item
+Partial Class | class | Item
![All-in-One .NET MAUI App Project Template](images/dotnetmaui-all-in-one-project-template-pinned.png)
@@ -371,6 +372,11 @@ Resource Dictionary:
dotnet new maui-resdict -n LightTheme -na MyApp.Themes
```
+Partial Class:
+```shell
+dotnet new class -n BaseViewModel
+```
+
With parameter names expanded:
.NET MAUI App:
@@ -429,6 +435,11 @@ Resource Dictionary:
```shell
dotnet new maui-resdict --name LightTheme --namespace MyApp.Themes
```
+
+Partial Class:
+```shell
+dotnet new class --name BaseViewModel
+```