Giter Site home page Giter Site logo

egvijayanand / dotnet-maui-templates Goto Github PK

View Code? Open in Web Editor NEW
140.0 3.0 19.0 18.56 MB

.NET MAUI Project and Item Templates for VS2022 and CLI.

Home Page: https://egvijayanand.in/

License: MIT License

C# 65.58% Batchfile 4.39% HTML 7.04% CSS 4.96% Vim Snippet 9.78% F# 3.88% PowerShell 4.38%
extensions templates dotnet dotnet6 code-snippets cli dotnet-maui maui-blazor android ios

dotnet-maui-templates's Introduction

.NET MAUI Project and Item Templates

This repository is to host the .NET MAUI Project Templates, Item Templates and Code Snippets.

Join me on Developer Thoughts, an exclusive blog for .NET MAUI and Blazor, for articles on working with these templates and much more.

We all know that .NET MAUI is an evolution of Xamarin.Forms.

Release Details:

Channel .NET MAUI Version IDE Version Release Date Remarks
Stable .NET 6 SR11 (6.0.553) VS2022 17.4.x - 17.8.x Tue, Apr 25, 2023 Out of Support
Stable .NET 7 SR10 (7.0.101) VS2022 17.4.x - 17.9.x Tue, Nov 7, 2023 Maintenance
Stable .NET 8 SR5 (8.0.20)
Requires Android SDK Platform 34
VS2022 17.9.x Tue, Apr 9, 2024 Active
Preview .NET 9 Preview 3 (9.0.0-preview.3.10457)
Requires Android SDK Platform 34
VS2022 17.10 Preview 4.0 Thu, Apr 11, 2024 Preview

Use the below commands to verify the version installed:

dotnet --version
dotnet workload list

And to install a workload, run the following command:

On Windows, this is to be executed on an elevated prompt:

dotnet workload install maui

On macOS:

sudo dotnet workload install maui

On Linux (Only Android workload is supported for now):

sudo dotnet workload install maui-android

If already installed, can be updated to the latest version with the below command:

dotnet workload update

Templates have been updated to support .NET 6/7/8 and is available to install from.

Channel NuGet VS Marketplace
Stable VijayAnand.MauiTemplates - NuGet Package .NET MAUI Project and Item Templates - VS Marketplace

For VS2022 users:

To provide an integrated experience, a VS extension has been developed to host these templates.

Extension is made available in the Visual Studio Marketplace and even more easier, can be installed from within Visual Studio itself (Extensions -> Manage Extensions / Alt + X + M).

Manage Extensions - Visual Studio

This has Project Templates for:

  • .NET MAUI App - An All-in-One .NET MAUI App Project Template - For more details, check out this article
  • .NET MAUI Class Library
  • Shared Class Library (Xamarin.Forms and .NET MAUI)

Create Project - Visual Studio

And has Item Templates for:

  • Generic Item
  • Generic Item (C#)
  • Content Page
  • Content Page (C#)
  • Content Page (Razor)
  • Content Page with BlazorWebView
  • Content Page with BlazorWebView (C#)
  • Content Page with ViewModel
  • Content Page (C#) with ViewModel
    • For both the Page with ViewModel templates, ensure only the real page name alone is provided as input like Settings as the Page and ViewModel will be suffixed to it like SettingsPage and SettingsViewModel. And Page will be generated in the Views folder and ViewModel will be generated in the ViewModels folder.
    • The ViewModels are generated with the base class titled BaseViewModel (implementation left to the user).
    • Recommended to add CommunityToolkit.Mvvm, an officially supported NuGet package, to make it easy to work with MVVM design pattern.
    • This MVVM - Made Easy Part 1 and Part 2 articles can help you to get started with this brand-new NuGet package.
  • Content View
  • Content View (C#)
  • Content View (Razor)
  • Resource Dictionary
  • Resource Dictionary (XAML only)
  • Shell Page
  • Shell Page (C#)
  • Custom View and Handler (Regular)
    • Handler definitions generated in the Platforms folder
  • Custom View and Handler (Cond.)
    • Handler definitions generated in the same folder in conditional compilation format
  • Custom View and Renderer (Regular)
    • Renderer definitions generated in the Platforms folder
  • Custom View and Renderer (Cond.)
    • Renderer definitions generated in the same folder in conditional compilation format
  • Comet Page (C#)
  • Partial Class (C#)
    • Made available in the section titled Code
       
  • For Cond. type template to work properly, ensure Conditional Compilation is enabled (mentioned in detail here)

Now VS2022 extension is loaded with 25+ C# and XAML Code Snippets.

XAML Snippets for new Layouts, Gestures, Color, Style.

C# Snippets for Properties such as Attached, Bindable, ViewModel and Comet (MVU design pattern).

Types such as record and record struct.

Snippets for Method definition, Event Handler definition (async version also).

Add New Item dialog - Visual Studio

.NET CLI Template

For making use of these templates cross-platform, have provided it as .NET CLI template package distributed via NuGet.

Install the template package from NuGet with the below command.

Stable:

dotnet new install VijayAnand.MauiTemplates

If you've already installed this package, then this can be updated to the latest version with the below command.

dotnet new update --check-only
dotnet new update

This comes with with the following templates:

Name Template Name Type
All-in-One .NET MAUI App mauiapp Project
.NET MAUI Class Library mauiclasslib Project
Shared Class Library sharedclasslib Project
.NET MAUI Item (XAML) maui-item Item
.NET MAUI Item (C#) maui-item-cs Item
ContentPage (XAML) maui-page Item
ContentPage (C#) maui-page-cs Item
ContentPage (Razor) maui-page-razor Item
ContentView (XAML) maui-view Item
ContentView (C#) maui-view-cs Item
ContentView (Razor) maui-view-razor Item
ResourceDictionary maui-resdict Item
ShellPage (XAML) maui-shell Item
ShellPage (C#) maui-shell-cs Item
ShellPage (Razor) maui-shell-razor Item
ContentPage with ViewModel maui-mvvm Item
ContentPage with ViewModel (C#) maui-mvvm-cs Item
ContentPage with BlazorWebView (XAML) maui-bwv Item
ContentPage with BlazorWebView (C#) maui-bwv-cs Item
Partial Class (C#) class-cs Item

All-in-One .NET MAUI App Project Template

Parameters:

Starting with v2.0.0 of the template package, to effectively support .NET MAUI on both .NET 6 and .NET 7, CLI project template defines a new parameter named framework:

And from v3.0.0 of the template package, CLI project template framework parameter adds .NET 8 as another option.

And from v4.0.0 of the template package, CLI project template defines a new parameter named language:

And from v4.4.0 of the template package, CLI project template defines a new parameter named central-pkg-mgmt:

And from v4.5.0 of the template package, CLI project template defines a new parameter named include-shared-toolkit:

And from v4.6.0 of the template package, CLI project template defines a new parameter named nightly:

And from v5.0.0 of the template package, CLI project template framework parameter adds .NET 9 as another option.

  • Nightly build: (Short notation: -ni):

    Option to reference Nightly build MAUI packages (from the CI feed) in all the supported templates.

    -ni | --nightly This is a Boolean parameter - Default value is false. Can also be used with the CPM option too.

    Note: For this work, add the following URL as a NuGet package source (make use of the command) and more details here:

    .NET MAUI getting released as NuGet packages is supported only from .NET 8. So, this nightly build option won't work with .NET 7 and earlier.

    dotnet nuget add source -n maui-nightly https://aka.ms/maui-nightly/index.json

    Examples:

    dotnet new mauiapp -o MyApp -ni
    dotnet new mauiclasslib -o MauiLib -ni
    dotnet new sharedclasslib -o SharedLib -ni
  • Central Package Management: (Short notation: -cpm):

    This is a Boolean parameter and its default value is false. For now, this option is supported only on CLI.

    Examples:

    dotnet new mauiapp -o MyApp -cpm
    dotnet new mauiclasslib -o MauiLib -cpm
    dotnet new sharedclasslib -o SharedLib -cpm
  • Language: (Short notation: -lang):

    This can take C# / F# as its options (with C# being the default value, if not specified).

    Examples:

    dotnet new mauiapp -lang F#

    For creating a .NET MAUI App on .NET 7:

    dotnet new mauiapp -lang F# -f net7.0
  • Framework: (Short notation: -f)

    This can take net6.0 / net7.0 / net8.0 / net9.0 as its options (with net8.0 being the default value, if not specified).

    Examples:

    dotnet new mauiapp -f net6.0
    dotnet new mauiapp -f net7.0

    For creating a .NET MAUI App on .NET 8:

    Below command can be simplified to dotnet new mauiapp as default value of framework parameter is net8.0

    dotnet new mauiapp -f net8.0

    For creating a .NET MAUI App on .NET 9:

    Explicit value for the framework parameter is required.

    dotnet new mauiapp -f net9.0

In .NET CLI, all of these Items Template require a mandatory parameter:

  • Name: (Short notation: -n)

    The name of the Item/Page/View to create. For Pages/Views, don't need to suffix it with the name like .xaml, it will get added.

    If the name parameter is not specified, by default, the .NET CLI template engine will take the current folder name as the filename (current behaviour of the templating engine).

  • Now with more options while creating the app or class library project, ability to include NuGet packages on the fly for CommunityToolkit.Maui, CommunityToolkit.Maui.Markup, CommunityToolkit.Mvvm or all.

Note: Parameter values are case-insensitive.

Both .NET MAUI App and Class Library templates take the below optional Boolean parameters to include the officially supported CommunityToolkit NuGet packages:

Specifying the parameter name, either in short or full notation, implies that it is defined.

  • -it | --include-toolkit - Default is false
  • -im | --include-markup - Default is false
  • -imt | --include-mvvm-toolkit - Default is false

Other Parameters:

  • -ist | --include-shared-toolkit - Default is false
  • -cc | --conditional-compilation - Default is false

Conditional Compilation

And now conditional compilation can be configured so that platform source files can be defined anywhere in the project provided they follow a naming convention as mentioned below. This will allow maintaining related source files in the same place, especially MAUI Handlers.

  • *.Standard.cs - Files targeting the BCL
  • *.Android.cs - Files specific to Android
  • *.iOS.cs - Files shared with both iOS and MacCatalyst
  • *.MacCatalyst.cs - Files specific to MacCatalyst
  • *.Tizen.cs - Files specific to Tizen
  • *.Windows.cs - Files specific to Windows

For existing projects, add the below block of code in the project file (.csproj). This will modify the behavior of build process so due care must be taken if doing so.

<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
    <Compile Remove="**\*.Standard.cs" />
    <None Include="**\*.Standard.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'ios' AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'maccatalyst'">
    <Compile Remove="**\*.iOS.cs" />
    <None Include="**\*.iOS.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
    <Compile Remove="**\iOS\**\*.cs" />
    <None Include="**\iOS\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'android'">
    <Compile Remove="**\*.Android.cs" />
    <None Include="**\*.Android.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
    <Compile Remove="**\Android\**\*.cs" />
    <None Include="**\Android\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'maccatalyst'">
    <Compile Remove="**\*.MacCatalyst.cs" />
    <None Include="**\*.MacCatalyst.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
    <Compile Remove="**\MacCatalyst\**\*.cs" />
    <None Include="**\MacCatalyst\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'tizen'">
    <Compile Remove="**\*.Tizen.cs" />
    <None Include="**\*.Tizen.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
    <Compile Remove="**\Tizen\**\*.cs" />
    <None Include="**\Tizen\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
    <Compile Remove="**\*.Windows.cs" />
    <None Include="**\*.Windows.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
    <Compile Remove="**\Windows\**\*.cs" />
    <None Include="**\Windows\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>

All-in-One .NET MAUI App Project Template:

This takes two additional parameters to define the application design pattern and target platform respectively. Not all options are supported in the F# template. For now, only Plain and Hybrid option is available.

  • -dp | --design-pattern

Can take any one of the following values, with default value set to Plain:

Parameter Value Description
Plain App configured to work with a single, initial screen.
Hierarchical App configured to work in a Hierarchical pattern using NavigationPage.
Tab App configured to work in a Tabbed fashion using TabbedPage.
Shell App configured to work with Routes using Shell page.
Hybrid App configured to work in a Hybrid fashion using BlazorWebView.
Markup App configured to work with C# Markup syntax.
Razor App configured to work with Razor syntax.
Comet App configured to work with MVU pattern using Comet.
Reactor App configured to work with MVU pattern using Reactor.
  • -tp | --target-platform

Can take a combination of the following values, with default value set to All:

Parameter Value Description
All Targets all possible .NET MAUI supported platforms.
Base Base framework (.NET 6/7/8) based on the framework opted.
Android Targets Android platform.
iOS Targets iOS platform.
macOS Targets macOS platform via Mac Catalyst.
Windows Targets Windows platform.
Tizen Targets Tizen platform.
Mobile Targets Android and iOS platforms.
Desktop Targets Windows and macOS platforms.
Apple Targets iOS and macOS platforms.

Target Platform Options - Visual Studio

Additional parameters supported:

MVVM is a delightful and development-friendly design pattern to work with. To support this, a new parameter has been introduced:

  • -mvvm | --use-mvvm - Default is false
  • -icb | --include-compiled-bindings - Default is false

Note: Opting for this MVVM option will not have any impact on the App created with Web-based Razor syntax or MVU based Comet/Reactor.

While creating a Blazor Hybrid App, an option to abstract the Razor components as a separate Razor class library.

  • -rcl | --razor-class-library - Default is false

The target for the Windows platform can be either Package (MSIX) or Unpackaged. By default, it is set as Package, this can be overridden while creating the project by including the below parameter:

  • -wu | --windows-unpackaged - Default is false

While targeting .NET 7 or later, 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

With Windows as a target platform, opting for the Maps feature will also include CommunityToolkit.Maui.Maps NuGet package.

Note: If the project target .NET 6, selecting the MediaElement/Foldable/Maps option will NOT have any impact.

Examples (passing one or more values):

dotnet new mauiapp --design-pattern Hybrid --target-platform Mobile
dotnet new mauiapp -dp Shell -tp Android iOS Windows

.NET MAUI Class Library Template:

Similar to All-in-One .NET MAUI App, the Class Library project template also takes target-platform as a parameter that takes a combination from the same set of values (with All being the default value).

  • Can be created targeting .NET Razor SDK
    • Parameter name: --use-razor-sdk | -urs
  • Can be created targeting .NET MAUI Core
    • Parameter name: --use-maui-core | -umc
  • Can be created targeting .NET MAUI Essentials
    • Parameter name: --use-maui-essentials | -ume

Class Library Project Options - Visual Studio

Shared Class Library Template:

The Target Framework of Xamarin.Forms library can be defined with the the below parameter.

  • -xf | --xamarin-forms

Supported values are:

  • netstandard2.0 (Default, if not specified)
  • netstandard2.1

Define the Target Framework of .NET MAUI library with the -f | --framework parameter.

This takes the below optional Boolean parameters to include the officially supported NuGet packages:

Specifying the parameter name, either in short or full notation, implies that it is defined.

Single parameter to include all the supported NuGet packages:

  • -asp | --all-supported-packages - Default is false

Specific to Xamarin.Forms:

  • -ife | --include-forms-essentials - Default is false
  • -ift | --include-forms-toolkit - Default is false
  • -ifm | --include-forms-markup - Default is false

Specific to .NET MAUI:

  • -imt | --include-maui-toolkit - Default is false
  • -imm | --include-maui-markup - Default is false

Common to both:

  • -inmt | --include-mvvm-toolkit - Default is false
  • -ist | --include-shared-toolkit - Default is false

For more details: run this command in the terminal (use -h to save some keystrokes):

dotnet new mauiapp --help
dotnet new mauiclasslib --help
dotnet new sharedclasslib --help

Partial Class Item Template:

This item template (short name: class-cs) allows to create a C# class from CLI with support for multiple options.

Parameter Name Type Default Value Remarks
access-modifier choice public Specifies the accessibility of the class type.
base text object Specifies the base type for the class.
abstract bool false Option to create the type as abstract.
partial bool true Option to create the type as partial.
sealed bool false Option to create the type as sealed.
static bool false Option to create the type as static.

Access Modifier parameter (--access-modifier | -am):

Supported values are:

  • public (default value, if not provided)
  • internal
  • protected
  • private

File-scoped Namespace parameter (-fsn | --file-scoped-namespace), the default value is false.

Usage:

After installation, use the below command(s) to create new artifacts using the template (both provide the same output):

With parameter names abbreviated:

.NET MAUI App:

dotnet new mauiapp -n MyApp -dp Shell
dotnet new mauiapp -n MyApp -dp Hybrid
dotnet new mauiapp -n MyApp -dp Markup
dotnet new mauiapp -n MyApp -dp Razor
dotnet new mauiapp -n MyApp -dp Comet
dotnet new mauiapp -n MyApp -dp Reactor

Option to use MVVM:

dotnet new mauiapp -n MyApp -mvvm
dotnet new mauiapp -n MyApp -dp Markup -mvvm

Option to use MVVM (Compiled Bindings):

dotnet new mauiapp -n MyApp -mvvm -icb

Option to create Razor class library while creating Blazor Hybrid App:

dotnet new mauiapp -n MyApp -dp Hybrid -rcl

Option to include NuGet packages:

dotnet new mauiapp -n MyApp -dp Shell -it -im -imt -ime -inm -if

Option to configure conditional compilation:

dotnet new mauiapp -n MyApp -dp Shell -cc

.NET MAUI Class Library:

dotnet new mauiclasslib -n MyApp.Core

Option to include NuGet packages:

dotnet new mauiclasslib -n MyApp.Core -it -im -imt

Option to configure conditional compilation:

dotnet new mauiclasslib -n MyApp.Core -cc

Shared Class Library:

dotnet new sharedclasslib -n MyApp.UI

Option to include all supported NuGet packages:

dotnet new sharedclasslib -n MyApp.UI -asp

Generic Item Template:

  • A revolutionary generic template, in XAML and C#, for creating items of any type
  • Supported both within the VS2022 IDE and CLI
  • On CLI, it is named as maui-item and maui-item-cs
  • The same set of parameters is defined in the UI as dropdown, textbox and checkbox for ease of use
  • Both needs one required parameter, -b / --base, the base type
  • And optionally takes another parameter, -g / --generic, to specify the generic base type
  • In addition, the XAML template takes one more parameter, -xo / --xaml-only, to generate only the XAML definition
  • Frequently used base types are loaded in the Editable dropdown, user can also enter their value here
  • Ensure the values are entered in Pascal notation. XAML templates support XML namespace prefix, quite like how it is used in real world (mct:Popup)
  • The one big advantage of using this on IDE is the relative namespace to the folder where the item is created whereas on CLI, this defaults to the root namespace. As relative namespace resolution is yet to be fully supported by the CLI templating engine and is actively tracked here

.NET MAUI All-in-One Generic Item Template

Note: Namespace resolution in both XAML and C# files is left to the user as deriving them with the template is outside its scope.

Tip: For the XAML template, pass the xmlns scope as part of the input parameter value and it'll be used appropriately in the generated source files.

Tip: Use local scope to refer to the files in the same directory like Views. For example, local:BasePage

CLI Commands:

dotnet new maui-item -n LoginPage -b ContentPage
dotnet new maui-item-cs -n ProductView -b ContentView
dotnet new maui-item -n CartPage -b MauiPage -g CartViewModel

For Page/Shell/View Item templates, don't suffix anything to the name, it'll be included automatically.

Pages:

dotnet new maui-page -n Home
dotnet new maui-page-cs -n Home
dotnet new maui-page-razor -n Home

Page with ViewModel:

dotnet new maui-mvvm -n Login
dotnet new maui-mvvm-cs -n Login

ContentPage with BlazorWebView:

dotnet new maui-bwv -n Home
dotnet new maui-bwv-cs -n Home

Views:

dotnet new maui-view -n Order
dotnet new maui-view-cs -n Order
dotnet new maui-view-razor -n Order

Shell:

dotnet new maui-shell -n App
dotnet new maui-shell-cs -n App
dotnet new maui-shell-razor -n App

Resource Dictionary:

dotnet new maui-resdict -n DarkTheme
dotnet new maui-resdict -n LightTheme -xo

Partial Class:

dotnet new class-cs -n BaseViewModel
dotnet new class-cs -n BaseViewModel -fsn
dotnet new class-cs -n OrderDataStore -b IDataStore -p false -am internal

With parameter names expanded:

.NET MAUI App:

dotnet new mauiapp --name MyApp --design-pattern Shell
dotnet new mauiapp --name MyApp --design-pattern Hybrid
dotnet new mauiapp --name MyApp --design-pattern Markup
dotnet new mauiapp --name MyApp --design-pattern Razor
dotnet new mauiapp --name MyApp --design-pattern Comet
dotnet new mauiapp --name MyApp --design-pattern Reactor

Option to use MVVM:

dotnet new mauiapp --name MyApp --use-mvvm
dotnet new mauiapp --name MyApp --design-pattern Markup --use-mvvm

Option to use MVVM (Compiled Bindings):

dotnet new mauiapp --name MyApp --use-mvvm --include-compiled-bindings

Option to create Razor class library while creating Blazor Hybrid App:

dotnet new mauiapp --name MyApp --design-pattern Hybrid --razor-class-library

Option to include NuGet packages:

dotnet new mauiapp --name MyApp --design-pattern Shell --include-toolkit --include-markup --include-mvvm-toolkit --include-media-element --include-maps --include-foldable
dotnet new mauiapp --name MyApp --design-pattern Shell --conditional-compilation

.NET MAUI Class Library:

dotnet new mauiclasslib --name MyApp.Core
dotnet new mauiclasslib --name MyApp.Core --include-toolkit --include-markup --include-mvvm-toolkit
dotnet new mauiclasslib --name MyApp.Core --conditional-compilation

Shared Class Library:

dotnet new sharedclasslib --name MyApp.UI
dotnet new sharedclasslib --name MyApp.UI --all-supported-packages

Generic Item Template:

dotnet new maui-item --name LoginPage --base ContentPage
dotnet new maui-item-cs --name ProductView --base ContentView
dotnet new maui-item --name CartPage --base MauiPage --generic CartViewModel

For Page/Shell/View Item templates, don't suffix anything to the name, it'll be included automatically.

Pages:

dotnet new maui-page --name Home
dotnet new maui-page-cs --name Home
dotnet new maui-page-razor --name Home

Page with ViewModel:

dotnet new maui-mvvm --name Login
dotnet new maui-mvvm-cs --name Login

ContentPage with BlazorWebView:

dotnet new maui-bwv --name Home
dotnet new maui-bwv-cs --name Home

Views:

dotnet new maui-view --name Order
dotnet new maui-view-cs --name Order
dotnet new maui-view-razor --name Order

Shell:

dotnet new maui-shell --name App
dotnet new maui-shell-cs --name App
dotnet new maui-shell-razor --name App

Resource Dictionary:

dotnet new maui-resdict --name DarkTheme
dotnet new maui-resdict --name LightTheme --xaml-only

Partial Class:

dotnet new class-cs --name BaseViewModel
dotnet new class-cs --name BaseViewModel --file-scoped-namespace
dotnet new class-cs --name OrderDataStore --base IDataStore --partial false --access-modifier internal

dotnet-maui-templates's People

Contributors

adospace avatar egvijayanand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dotnet-maui-templates's Issues

Shell Page Support for PR8

Now that PR8 has actual templates for MAUI, it has fully embraced the HostBuilder pattern.

Are there any pointers on how to get your Shell Page template to get instantiated correctly?

I tried just adding the override from the blog post announcement, but it doesnt seem to work.

FYI: Your placeholder templates were a great help!

Thanks.

Generic Item Templates for Visual Studio

  • Support for Generic Item Templates within Visual Studio 2022 IDE (both XAML and C#)
  • Support for relative namespace up to the folder where the item is created
  • Support for XAML only option in case of XAML template

Gesture issue in Tab template

Hello,
in the Tab template, there is the possibility to swipe left and right to change Tab.
I see that the "header" and "footer" are not updated according to the current page (i.e. scrolling right from "calendar" to "search" leave the header of the calendar page and the footer with the pages name do not change to highlight the search page)

EDIT:
I saw this issue with the property:
android:TabbedPage.ToolbarPlacement="Bottom"

With the property set to Top it works.

Compile error with RC1

Need instructions on use. Compile errors with Microsoft.Graphics.Win2D and Microsoft.WindowsAppSDK not upgrading the nuget. If you manually fix it in the csproj, 3 other compile errors occur.

Support for .NET MAUI Templates on .NET 7

Now .NET MAUI is supported on .NET 7, the templates need to be updated to support .NET 7 as well. This needs to be handled as an input parameter with a pre-defined value, if not supplied.

Build fails for .NET MAUI class library with .NET MAUI Essentials targeting the Windows platform

Build fails for .NET MAUI class library with .NET MAUI Essentials targeting the Windows platform.

Template Package Version:

3.1.0-preview.2

Error message:

D:\NuGet\packages\Microsoft.WindowsAppSDK\1.2.230118.102\buildTransitive\MrtCore.PriGen.targets(380,5): error MSB4062: The "Microsoft.Build.AppxPackage.GetSdkFileFullPath" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\8.0.100-preview.1.23115.2\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.Build.AppxPackage.dll. Could not load file or assembly 'C:\Program Files\dotnet\sdk\8.0.100-preview.1.23115.2\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.Build.AppxPackage.dll'. The system cannot find the path specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available,and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [E:\SampleLib\SampleLib.csproj::TargetFramework=net8.0-windows10.0.19041.0]

Installation on VS 2022 failed

Today i tried to install your VS Extension from Marketplace. Sadly i'm got:

20.08.2022 20:30:49 - Microsoft VSIX Installer
20.08.2022 20:30:49 - -------------------------------------------
20.08.2022 20:30:49 - vsixinstaller.exe version:
20.08.2022 20:30:49 - 17.2.2197
20.08.2022 20:30:49 - -------------------------------------------
20.08.2022 20:30:49 - Command line parameters:
20.08.2022 20:30:49 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\Admin\Downloads\VijayAnand.MauiTemplates.vsix
20.08.2022 20:30:49 - -------------------------------------------
20.08.2022 20:30:49 - Microsoft VSIX Installer
20.08.2022 20:30:49 - -------------------------------------------
20.08.2022 20:30:50 - Initializing Install...
20.08.2022 20:30:50 - Erweiterungsdetails...
20.08.2022 20:30:50 - Identifier : MauiTemplates.20dca96a-7311-401f-84ed-980478fb319b
20.08.2022 20:30:50 - Name : .NET MAUI Project and Item Templates
20.08.2022 20:30:50 - Author : Vijay Anand E G
20.08.2022 20:30:50 - Version : 1.7.6.3
20.08.2022 20:30:50 - Description : .NET MAUI Project, Item Templates, and Code Snippets for Visual Studio 2022 (.NET MAUI GA and Service Releases).
20.08.2022 20:30:50 - Locale : en-US
20.08.2022 20:30:50 - MoreInfoURL : https://egvijayanand.in/2022/04/20/all-in-one-dotnet-maui-app-project-template-what-is-new/
20.08.2022 20:30:50 - InstalledByMSI : False
20.08.2022 20:30:50 - SupportedFrameworkVersionRange : [0.0,2147483647.2147483647]
20.08.2022 20:30:50 -
20.08.2022 20:30:50 - SignatureState : Unsigned
20.08.2022 20:30:50 - Unterstützte Produkte :
20.08.2022 20:30:50 - Microsoft.VisualStudio.Community
20.08.2022 20:30:50 - Version : [17.3,18.0)
20.08.2022 20:30:50 - ProductArchitecture : amd64
20.08.2022 20:30:50 - Microsoft.VisualStudio.Pro
20.08.2022 20:30:50 - Version : [17.3,18.0)
20.08.2022 20:30:50 - ProductArchitecture : amd64
20.08.2022 20:30:50 - Microsoft.VisualStudio.Enterprise
20.08.2022 20:30:50 - Version : [17.3,18.0)
20.08.2022 20:30:50 - ProductArchitecture : amd64
20.08.2022 20:30:50 -
20.08.2022 20:30:50 - Verweise :
20.08.2022 20:30:50 - Voraussetzungen :
20.08.2022 20:30:50 - -------------------------------------------------------
20.08.2022 20:30:50 - Identifier : Microsoft.VisualStudio.Component.CoreEditor
20.08.2022 20:30:50 - Name : Visual Studio core editor
20.08.2022 20:30:50 - Version : [17.3,)
20.08.2022 20:30:50 -
20.08.2022 20:30:50 - -------------------------------------------------------
20.08.2022 20:30:50 - Identifier : Microsoft.VisualStudio.ComponentGroup.Maui.All
20.08.2022 20:30:50 - Name : .NET MAUI
20.08.2022 20:30:50 - Version : [17.3.32505.122,18.0)
20.08.2022 20:30:50 -
20.08.2022 20:30:50 - Signaturdetails...
20.08.2022 20:30:50 - Extension is not signed.
20.08.2022 20:30:50 -
20.08.2022 20:30:50 - Er wird nach passenden Produkten gesucht...
20.08.2022 20:30:50 - Installiertes Produkt gefunden - Globaler Pfad
20.08.2022 20:30:50 - Installiertes Produkt gefunden - Visual Studio Enterprise 2022 LTSC 17.2
20.08.2022 20:30:50 - VSIXInstaller.NoApplicableSKUsException: Diese Erweiterung kann auf den derzeit installierten Produkten nicht installiert werden.
bei VSIXInstaller.ExtensionService.GetInstallableDataImpl(IInstallableExtension extension, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable1& skuData) bei VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable1& skuData)
bei VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
bei VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
bei VSIXInstaller.App.Initialize(Boolean isRepairSupported)
bei VSIXInstaller.App.Initialize()
bei System.Threading.Tasks.Task`1.InnerInvoke()
bei System.Threading.Tasks.Task.Execute()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Do you know, how to fix it?

Support for Maui preview 13

Hi.
Maui preview 13 is out today, with support from VS 2022 17.2.0 preview 1.0.
Is there an expected date for maui 13 support?
I am using preview 12 templates, but they do not appear in the File / New Ctrl+N dialog.
Thanks for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.