Skip to content

seangwright/xperience-community-dotnet-item-templates

Repository files navigation

Xperience Community: .NET Item Templates

CI: Build and Test

Release: Publish to NuGet

.NET CLI Item Templates for Xperience by Kentico projects, usable at the command line or in Visual Studio

These templates are setup for Xperience by Kentico v26.3.0

Setup

Install

NuGet Package

Install the XperienceCommunity.DotnetItemTemplates NuGet Template package globally:

dotnet new install XperienceCommunity.DotnetItemTemplates

Or, update the templates to the latest version if you already have them installed

dotnet new update

Use

Use the templates in Visual Studio or at the command line:

dotnet new xpc-page-builder-widget -n HeroWidget -o .\MySite.Web\Components\Widgets

This will generate a new folder automatically: .\MySite.Web\Components\Widgets\Hero containing the following files:

  • HeroWidget.cs
  • Hero.cshtml

To view the list of all the templates that are installed with this package run dotnet new list at the command line.

Screenshots

Visual Studio new item dialog

Using the Widget Item Template in Visual Studio

Templates

This package includes the following item templates.

Required Suffix

Note: Each template has a required suffix for the name of the item you are scaffolding. You can use any name you want as long as you include the suffix at the end of the name.

Admin

  • Admin Module

    • Required suffix AdminModule

      dotnet new xpc-admin-module -n AppleAdminModule -o .\App.Admin\Apples

    • Generates

      .\App.Admin\Apples\AppleAdminModule.cs

  • Admin Application Page

    • Required suffix ApplicationPage

      dotnet new xpc-admin-application-page -n AppleApplicationPage -o .\App.Admin\Apples

    • Generates

      .\App.Admin\Apples\AppleApplicationPage.cs

  • Admin Edit Page

    • Required suffix EditPage

      dotnet new xpc-admin-edit-page -n AppleEditPage -o .\App.Admin\Apples

    • Generates

      .\App.Admin\Apples\AppleEditPage.cs

  • Admin Edit Section Page

    • Required suffix EditSectionPage

      dotnet new xpc-admin-edit-section-page -n AppleEditSectionPage -o .\App.Admin\Apples

    • Generates

      .\App.Admin\Apples\AppleEditSectionPage.cs

  • Admin List Page

    • Required suffix ListPage

      dotnet new xpc-admin-list-page -n AppleListPage -o .\App.Admin\Apples

    • Generates

      .\App.Admin\Apples\AppleListPage.cs

  • Admin Create Page

    • Required suffix CreatePage

      dotnet new xpc-admin-create-page -n AppleCreatePage -o .\App.Admin\Apples

    • Generates

      .\App.Admin\Apples\AppleCreatePage.cs

  • Admin Page Extender

    • Required suffix PageExtender

      dotnet new xpc-admin-page-extender -n ApplePageExtender -o .\App.Admin\Apples

    • Generates

      .\App.Admin\Apples\ApplePageExtender.cs

  • Admin UI Form Component

    • Required suffix FormComponent

      dotnet new xpc-admin-ui-form-component -n AppleFormComponent -o .\App.Admin\Apples

    • Generates

      .\App.Admin\Apples\AppleFormcomponent.cs

  • Admin UI Form Component (TSX))

    • Required suffix FormComponent

      dotnet new xpc-admin-ui-form-component -lang TypeScript -n AppleFormComponent -o .\App.Admin\Client\src\apples

    • Generates

      .\App.Admin\Client\src\apples\AppleFormComponent.tsx

  • Validation Rule

    • Required suffix ValidationRule

      dotnet new xpc-admin-validation-rule -n FreshAppleValidationRule -o .\App.Admin\Apples

    • Generates

      .\App.Admin\Apples\FreshAppleValidationRule.cs

  • Validation Rule (TypeScript)

    • Required suffix ValidationRule

      dotnet new xpc-admin-validation-rule -lang TypeScript -n AppleValidationRule -o .\App.Admin\Client\src\apples

    • Generates

      .\App.Admin\Client\src\apples\AppleValidationRule.tsx

Form Builder

  • Form Component

    • Required suffix FormComponent

      dotnet new xpc-form-builder-form-component -n AppleFormComponent -o .\App.Web\Components\FormComponents

    • Generates

      .\App.Web\Components\FormComponents\Apple\AppleFormComponent.cs

      .\App.Web\Components\FormComponents\Apple\Apple.cshtml

  • Form Section

    • Required suffix FormSection

      dotnet new xpc-form-builder-form-section -n AppleFormSection -o .\App.Web\Components\FormSections

    • Generates

      .\App.Web\Components\FormSections\Apple\AppleFormSection.cs

      .\App.Web\Components\FormSections\Apple\Apple.cshtml

Page Builder

  • Widget

    • Required suffix Widget

      dotnet new xpc-page-builder-widget -n AppleWidget -o .\App.Web\Components\Widgets

    • Generates

      .\App.Web\Components\Widgets\Apple\AppleWidget.cs

      .\App.Web\Components\Widgets\Apple\Apple.cshtml

  • Section

    • Required suffix Section

      dotnet new xpc-page-builder-section -n AppleSection -o .\App.Web\Components\Sections

    • Generates

      .\App.Web\Components\Sections\Apple\AppleSection.cs

      .\App.Web\Components\Sections\Apple\Apple.cshtml

Building and Testing

Automated

Run the templates: reinstall VS Code task, which will perform all the manual steps below

Manual

  1. Make template changes
  2. Run the dotnet: build VS Code task to ensure the template changes compile
  3. Run the dotnet: pack VS Code task to package the templates
  4. Close all instances of VS
  5. Run the dotnet: uninstall template VS Code task to uninstall the template, if already installed
  6. Run the templates: clear cache VS Code task to clear the template cache
  7. Run the dotnet: install template VS Code task to install the locally packaged template (use the correct version number when prompted)
  8. Open VS and test the templates on an ASP.NET Core or class library project

Notes

Contributions

If you discover a problem, please open an issue.

If you would like contribute to the code or documentation, please open a pull request.

Please refer to the Code of Conduct when contributing to or opening issues for this repository.

About

.NET CLI Item Templates for Xperience by Kentico projects, usable at the command line or in Visual Studio

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published