Search code examples
.net-corepiranha-cms

Unable to get the Piranha CMS manager edit page to work


I am working on adding blogging functionality to an existing site and thought that Piranha might be the way to go. I have added the following:

csproj

<ItemGroup>
  <PackageReference Include="Piranha" Version="9.1.0" />
  <PackageReference Include="Piranha.AttributeBuilder" Version="9.1.0" />
  <PackageReference Include="Piranha.Data.EF.SQLServer" Version="9.1.0" />
  <PackageReference Include="Piranha.Data.EF.SQLite" Version="9.1.0" />
  <PackageReference Include="Piranha.ImageSharp" Version="9.1.0" />
  <PackageReference Include="Piranha.Local.FileStorage" Version="9.1.0" />
  <PackageReference Include="Piranha.AspNetCore" Version="9.1.0" />
  <PackageReference Include="Piranha.AspNetCore.Identity.SQLServer" Version="9.1.0" />
  <PackageReference Include="Piranha.AspNetCore.Identity.SQLite" Version="9.1.0" />
  <PackageReference Include="Piranha.Manager" Version="9.1.0" />
  <PackageReference Include="Piranha.Manager.TinyMCE" Version="9.1.0" />
</ItemGroup>  

Startup.cs

services.AddPiranha(options =>
{
    options.AddRazorRuntimeCompilation = true;

    options.UseFileStorage(naming: Piranha.Local.FileStorageNaming.UniqueFolderNames);
    options.UseImageSharp();
    options.UseManager();
    options.UseTinyMCE();
    options.UseMemoryCache();


    options.UseEF<SQLiteDb>(db =>
        db.UseSqlite("Filename=./piranha.mvcweb.db"));
    options.UseIdentityWithSeed<IdentitySQLiteDb>(db =>
        db.UseSqlite("Filename=./piranha.mvcweb.db"));
});

...

App.Init(api);
App.CacheLevel = Piranha.Cache.CacheLevel.Full;

new ContentTypeBuilder(api)
    .AddAssembly(typeof(Startup).Assembly)
    .Build()
    .DeleteOrphans();

Seed.RunAsync(api).GetAwaiter().GetResult();

Piranha.Manager.Editor.EditorConfig.FromFile("editorconfig.json");

app.UsePiranha(options => {
    options.UseManager();
    options.UseTinyMCE();
    options.UseIdentity();
});

I have also copied all the Views, Models, config files, Controllers, and static assets from the sample MVC app project and included them.

When I run the program, it loads the sample home page, and when I go to /manager, it lets me log in using the default credentials. I can see that the default pages are created. When I try to edit a page however, the designer never loads. Instead, when I inspect the page in chrome I get an error saying:

"TypeError: Cannot read property 'filename' of undefined"

I have attached a screenshot showing what loads up to that point and where the error occurs. Any help getting to the root of this would be appreciated.

errorscreenshot


Solution

  • I was able to resolve this issue by removing a call to services.AddMvc() that I had in my Startup after services.AddPiranha(). It looks like AddPiranha does this for you and putting in AddMvc causes things to get messed up.