Project Templates

PowerPortalsPro ships two project templates that scaffold a complete portal — Dataverse connectivity, authentication, security handlers, localization, and pre-built identity pages — ready to run in minutes. A React single-page app (recommended) and a Blazor web app are both available, and the PowerPortalsPro feature set is identical across the two. Pick whichever front-end stack fits your team.

Installing the Templates

Install the PowerPortalsPro.AspNetCore.Templates package from NuGet using the .NET CLI. Both templates ship in this one package:

Choosing a Template

Once installed, create a project from the .NET CLI or Visual Studio's "New Project" dialog (search for "Power Portals Pro"). Two templates are available — choose the one that matches your front-end stack:

React (Recommended)

An ASP.NET Core host paired with a React + Vite + TypeScript single-page app built on Fluent UI React. Recommended for new portals — modern front-end tooling, a fast hot-reload dev loop, and the broadest component set.

Blazor

An ASP.NET Core Blazor web app built on Fluent UI Blazor, with a render mode you choose at scaffold time via --interactivity. A great fit when your team works primarily in C# and prefers to stay entirely in the .NET UI stack.

Recommended

Both templates expose the same PowerPortalsPro capabilities — grids, editors, security, localization, and identity. We suggest React for new projects unless your team has a specific reason to stay all-C#, in which case the Blazor template is fully supported.

The React Template

The powerportalspro-react template generates two projects that run together:

Blazor Interactivity Modes

The Blazor template additionally accepts --interactivity Server, --interactivity WebAssembly, or --interactivity Auto to pick its render mode (the React template is always a single-page app, so it has no equivalent option). Picking a mode up front only affects the generated project layout — PowerPortalsPro itself runs correctly under all three. See the Blazor Interactivity page for a full comparison.

Tip

The --interactivity flag matches the stock dotnet new blazor template's flag of the same name, so anything you already know about Blazor render modes carries over.

Template Options

Both templates expose dotnet new options so you can tailor the generated project up front. Pass them on the command line, or pick them in Visual Studio's project-creation screen (and the dotnet new interactive UI). The most useful options:

For example, an Auto-rendered Blazor portal for both audiences, with Google sign-in and Azure machine translation:

Tip

Run dotnet new powerportalspro -h (or dotnet new powerportalspro-react -h) to list every option and its default. In Visual Studio these appear as checkboxes and dropdowns on the project-creation screen.

What's Included

The template generates a fully functional portal project with the following:

Understanding Program.cs

The Program.cs file is where all services are registered and the application pipeline is configured. Here is a breakdown of each section:

React template

The walkthrough below describes the Blazor template's Program.cs. The React template's host registers the same core services — AddPowerPortalsProWebServer(), the Dataverse ConnectionOptions, localization, security handlers, and email — but omits the Blazor-specific AddPowerPortalsProWebBlazorFluentUI() registration, serves the React SPA instead, and exposes the auth endpoints via MapAuthEndpoints<PortalUser>() rather than MapAdditionalIdentityEndpoints().

Distributed Cache

The template registers a memory-based distributed cache. In production, replace this with a persistent cache like Redis or SQL Server for better performance across multiple instances.

Fluent UI Registration

AddPowerPortalsProWebBlazorFluentUI() registers all Fluent UI Blazor components used by PowerPortalsPro editors, grids, and layout components.

Server Services

AddPowerPortalsProWebServer() registers the core server-side services including the Dataverse data access layer, security enforcement, interceptor pipeline, and localization loading.

Dataverse Connection

The ConnectionOptions configuration specifies how the portal authenticates with Dataverse. The template uses Client Secret authentication with credentials stored in appsettings.json or User Secrets.

Tip

For security best practices, store your credentials in User Secrets during development and Azure Key Vault or environment variables in production. Never commit secrets to source control.

Localization Configuration

AddLocalizationDirectory registers directories containing localization JSON files. By default LocalizeAllAvailableTables is true, so labels, column names, and view names are pulled from every Dataverse table automatically. Set it to false and use AddTableToLocalize / AddTablesToLocalize to restrict localization to an explicit list.

Identity Options

The IdentityOptions section configures ASP.NET Core Identity settings such as requiring email confirmation before login.

Machine Translation (optional)

Generate the project with --IncludeMachineTranslation to wire up machine translation for the Localization Admin page's Translate a file panel. The template adds the chosen provider's PowerPortalsPro.Web.Server.Translation.* package and its registration below; choose the provider with --MachineTranslationProvider: Azure (the default), DeepL, or Google. Supply the provider's key via configuration / user-secrets under Azure:Translation:Key, DeepL:Translation:Key, or Google:Translation:Key to match.

Tip

Without the option, the Localization Admin page still works — the pipeline overview and per-source / merged downloads are unaffected; only the translate panel stays hidden, and the registration ships as commented-out guidance so you can enable it later by hand.

Security Handler Registration

Permission handlers are registered in the DI container to control CRUD access for each table. The template includes handlers for Account (full access) and Contact (read-only with owner-based updates).

Email Configuration

The EmailServiceOptions configures the sender email address used for account confirmation and password reset emails. This is sent via the Dataverse email service.

Microsoft Authentication (Optional)

The template includes commented-out code for adding Microsoft Entra ID (Azure AD) authentication. Uncomment and configure your Client ID and Secret to enable external login via Microsoft accounts.

Middleware Pipeline

UsePowerPortalsProWebServer() adds the PowerPortalsPro middleware. UseLocalization() enables the localization system. MapAdditionalIdentityEndpoints() registers the cookie-based login endpoint used by the identity pages.

Two-Factor Authentication (Optional)

The template includes commented-out code for enabling Two-Factor Authentication using email-based codes. Uncomment the AuthenticatorTokenProvider option and the AddDefaultTokenProviders() call to enable it.

Common Customizations

After scaffolding the project, here are common next steps: