I am new to .NET Core and Angular. I want to build a blog site by .NET Core and Angular and
I found this github:
https://libraries.io/github/PiranhaCMS/piranha.core.angular

i know how to install but don’t have idea how to make the whole project running.
I already try to use the same version as this project and my idea is try to make the whole project up and running first then upgrade the versions gradually.
I tried to run backend first, but when I browse https://localhost:5001 then it shows

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
      An unhandled exception has occurred while executing the request.
System.InvalidOperationException: The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.
Your application is running in Production mode, so make sure it has been published, or that you have built your SPA manually. Alternatively you may wish to switch to the Development environment.

and when i try to run the angular frontend by command ng serve,
it shows

An unhandled exception occurred: No projects support the 'build' target.
See "/private/var/folders/qz/nshtnxp52h1cv72sj6vzp46w0000gn/T/ng-7qC8Wl/angular-errors.log" for further details.

does any one has idea how to make the whole project up and running?

Here’s how I do it to setup Piranha CMS + Angular. My requirement is to run Piranha as headless CMS with Angular responsible for the front-end.

My environment as of this writing:

  • .NET 5.0
  • Piranha 9.0.1
  • Piranha.AspNetCore.Identity 9.0.0
  • Piranha.AspNetCore.Identity.PostgreSQl 9.0.0
  • Piranha.Data.EF.PostgreSql 9.0.0
  • Piranha.Manager 9.0.1
  1. Setup empty piranha project like Håkan Edling mentioned.
dotnet new -i Piranha.Templates
dotnet new piranha.empty
  1. Setup Identity for Piranha CMS and Application. The tricky situation about this is if you install Piranha.AspNetCore.Identity, the package override Identity configurations, making it harder to customize your own user and roles. My approach is to separate Piranha Identity and Application Identity.

First, setup Piranha Identity

 options.UseIdentityWithSeed<IdentityPostgreSQLDb>(
                    db => db.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")),
                    ConfigureIdentity,
                    cookieOptions: co => // This part is optional
                    {
                        co.Cookie.Name = "YourOwnCookieName";
                        co.LoginPath = "/manager/login";
                        co.AccessDeniedPath = "/manager/login";
                        ...
                    }
                );

Next, setup application identity. Here, I used ApplicationUser as customized user for your application.

var identityBuilder = services.AddIdentityCore<ApplicationUser>(ConfigureIdentity);
identityBuilder = new IdentityBuilder(identityBuilder.UserType, typeof(IdentityRole), identityBuilder.Services);
identityBuilder.AddEntityFrameworkStores<ApplicationDbContext>();
identityBuilder.AddRoleValidator<RoleValidator<IdentityRole>>();
identityBuilder.AddRoleManager<RoleManager<IdentityRole>>();
identityBuilder.AddSignInManager<SignInManager<ApplicationUser>>();
identityBuilder.AddDefaultTokenProviders();

Here’s the code for ConfigureIdentity, you can customize it to suit your needs.

private void ConfigureIdentity(IdentityOptions options)
        {
            options.Tokens.PasswordResetTokenProvider = TokenOptions.DefaultPhoneProvider;
            options.Password.RequireDigit = false;
            options.Password.RequiredLength = 5;
            options.Password.RequireNonAlphanumeric = false;
            options.Password.RequireLowercase = false;
            options.Password.RequireUppercase = false;
            options.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+";
            options.User.RequireUniqueEmail = false;
        }

Since, I use PostgreSql as database, there’s a conflict involving index name between Piranha Identity and your Identity, to fix those you can rename your index with this code in your ApplicationDbContext OnModelCreating

builder.Entity<IdentityRole>().HasIndex(e => e.NormalizedName).HasDatabaseName("role_name_index");
builder.Entity<ApplicationUser>().HasIndex(e => e.NormalizedEmail).HasDatabaseName("email_index");
builder.Entity<ApplicationUser>().HasIndex(e => e.NormalizedUserName).HasDatabaseName("user_name_index");

By this point, you have two Identity running. If you setup migrations, both Piranha and your application use the same EFMigrationsHistory table. If you are not comfortable with this and want to separate the migrations table, you can add this code when you setup your ApplicationDbContext service:

services.AddDbContext<ApplicationDbContext>(options =>
                options
                    .UseNpgsql(
                        Configuration.GetConnectionString("DefaultConnection"),
                        builder =>
                        {
                            builder.MigrationsHistoryTable("__ef_migrations_history"); // separate migrations table
                        }
                    )
                    .UseSnakeCaseNamingConvention() // this is optional, from EFCore.NamingConventions package
            );

Piranha does not work well with package EFCore.NamingConventions if you want to use snake_case naming for example. There are many options here:

  1. Separate Piranha CMS database from your own database (which you can roll your own naming convention leaving Piranha naming convention as is).
  2. Use the same naming convention with Piranha CMS.
  3. Separate Piranha CMS database naming convention with your application naming convention (ugly, but it’s the one I used).

In case you run with options 3, in my case I want snake_case naming for my application tables, you have to rename your application Identity tables in ApplicationDbContext OnModelCreating since EFCore.NamingConventions doesn’t rename your Identity tables.

builder.Entity<ApplicationUser>().ToTable("asp_net_users");
builder.Entity<IdentityRole>().ToTable("asp_net_roles");
builder.Entity<IdentityUserToken<string>>().ToTable("asp_net_user_tokens");
builder.Entity<IdentityUserLogin<string>>().ToTable("asp_net_user_logins");
builder.Entity<IdentityUserClaim<string>>().ToTable("asp_net_user_claims");            
builder.Entity<IdentityUserRole<string>>().ToTable("asp_net_user_roles");
builder.Entity<IdentityRoleClaim<string>>().ToTable("asp_net_role_claims");
  1. At this point, Piranha CMS will run separately from your application. You can install Piranha.WebApi package to access piranha contents from API or you can roll your own API. The code for Piranha.WebApi is simple enough, you can easily customize the code from their repository: https://github.com/PiranhaCMS/piranha.core/tree/master/core/Piranha.WebApi. If you don’t care about your content authorization, you can add this options to enable anonymous access:
services.AddPiranha(options =>
            {
                options.UseApi(o => o.AllowAnonymousAccess = true);                
            });

Finally, you can disable Piranha routing

services.AddPiranha(options =>
            {
                options.DisableRouting();
            });

Being an official maintainer of Piranha CMS the project your referring to is a community project and seems to have been abandoned by its maintainer and is no longer available.

I suggest you setup an empty piranha application by following the docs, create a custom ApiController and create your Angular web application that calls that API.