9is still in beta. For documentation on the latest stable release, please change to version
This section shows how to setup and configure Piranha in your Application Startup and is intended for users who wants to create their application from scratch and not have this code generated by any of the available project templates.
If you want more information on how to create an
ASP.NET Coreweb application from Visual Studio you can find this here.
As we're going to setup the application from scratch we're going to start by creating an empty ASP.NET application using the standard project template provided with
.NET Core. Start by creating a new empty directory with the name you want for your project. We will name the directory
PiranhaWeb. After this is done position yourself in the directory and execute the following command in the terminal.
dotnet new web
After the project has been created, open the directory in you editor and open the
.csproj project file. Before adding packages to your project you will need to create an
ItemGroup section in your project file. After this is done your project file should look like this:
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> </PropertyGroup> <ItemGroup> </ItemGroup> </Project>
Before setting up your application you need to know how you application environment will look and pick the packages that suits it. This includes choosing packages for
File Storage. In this example we will choose packages that are good for creating a simple local test application, namely:
You can find a complete list of the different packages we provide here.
The following packages are needed for almost every type of application, no matter if it is a headless API-service or an integrated website. This includes the core library and tools for importing content types, data access, image manipulation and storage for uploaded media assets.
<ItemGroup> <PackageReference Include="Piranha" Version="8.4.2" /> <PackageReference Include="Piranha.AttributeBuilder" Version="8.4.0" /> <PackageReference Include="Piranha.Data.EF.SQLite" Version="8.4.0" /> <PackageReference Include="Piranha.ImageSharp" Version="8.4.0" /> <PackageReference Include="Piranha.Local.FileStorage" Version="8.4.0" /> </ItemGroup>
If you're building a classic integrated website you'll want to install the middleware components needed for routing and handling incoming requests to the application.
<ItemGroup> <PackageReference Include="Piranha.AspNetCore" Version="8.4.1" /> </ItemGroup>
To add the management interface to your web application you need to add some kind of authentication package to authorize users, the manager package and one of the available HTML editors. Here we have choosen the package for the Tiny editor.
<ItemGroup> <PackageReference Include="Piranha.AspNetCore.Identity.SQLite" Version="8.4.0" /> <PackageReference Include="Piranha.Manager" Version="8.4.1" /> <PackageReference Include="Piranha.Manager.TinyMCE" Version="8.4.0" /> </ItemGroup>