Home
Softono
CarrotCakeCMS-Core

CarrotCakeCMS-Core

Open source MIT C#
15
Stars
6
Forks
0
Issues
4
Watchers
1 week
Last Commit

About CarrotCakeCMS-Core

CarrotCakeCMS-Core is a template-based content management system built on .NET Core 8 using C, SQL Server, and jQuery. It features an intuitive WYSIWYG and drag-and-drop editing interface powered by TinyMCE, allowing users to manage website content without coding knowledge. The system supports multi-tenant architectures with shared databases and web roots, making it suitable for hosting multiple sites from a single installation. Key capabilities include a robust blogging engine with date-based URLs, category and tag management, RSS feed generation, and content import from WordPress XML files. Additional features cover site search, content scheduling for release and retirement, customizable administration folder names, and reusable layout views for efficient template design. The software automatically handles database schema updates upon application launch, though users are advised to backup databases before updates to prevent data loss. It requires SQL Server 2016 or higher due to Entity Framework Core 8 depe

Platforms

Web Self-hosted Windows

Languages

C#

CarrotCakeCMS (MVC Core)

Source code for CarrotCakeCMS (MVC - Core), .Net Core 8

Welcome

Welcome to the GitHub project for CarrotCake CMS MVC Core, an open source C# project. CarrotCake is a template-based MVC ASP.NET Core CMS (content management system) built with C#, SQL Server, jQueryUI, and TinyMCE, providing an intuitive WYSIWYG/drag-and-drop edit experience. This content management system supports multi-tenant webroots with shared databases.

If you have found this tool useful please contact us.

Source code and documentation is available on GitHub and SourceForge. Documentation and assemblies can be found here.

[!IMPORTANT] Database Usage Notice

  • Automatic Schema Updates: Running the application against an existing database will automatically attempt to update schema artifacts.
  • Backup First: Always ensure you have a full database backup before running a new version of the code.
  • No Database Sharing: Do not share a single database between the Core, MVC 5, and WebForms editions of CarrotCakeCMS.

Features

Some features include: blogging engine, configurable date-based blog post URLs, content association with categories and tags, assignment/customization of category and tag URL patterns, simple content feedback collection and review, blog post pagination/indexes (with templating support), designation of default listing blog page (required for search and category/tag links), URL date formatting patterns, RSS feed support for posts and pages, import/export of site content, and import from WordPress XML files.

Other features also include date-based release and retirement of content, site time-zone designation, site search, and the ability to rename the administration folder. It also supports the use of layout views to provide re-use when designing content view templates.


CarrotCakeCMS (MVC Core) Developer Quick Start Guide

Copyright (c) 2011, 2015, 2023, 2024, 2026 Samantha Copeland Licensed under the MIT or GPL v3 License

CarrotCakeCMS (MVC Core) is maintained by Samantha Copeland

Install Development Tools

  1. Visual Studio Community/Pro/Enterprise (VS 2022 Community) - Typically being developed on VS 2022 Enterprise. Use of MSBuild for 2022 is also acceptable. Both require patch version 17.8 or later for .NET 8 support.
  2. SQL Server Express 2016 (or higher/later) - Currently vetted on 2016 and 2019 (Express Editions). Entity Framework Core 8 does not work with older versions of SQL Server, such as 2014/2012/2008R2 and earlier.
  3. SQL Server Management Studio (SSMS) - Required for managing the database.

Get the Source Code

  1. Go to the repository (GitHub or SourceForge) in a browser

  2. Download either a GIT or ZIP archive or connect using either a GIT or SVN client

Open the Project

  1. Start Visual Studio

  2. Open the CarrotCakeCoreMVC.sln solution in the root of the repository

    Note: If your file extensions are hidden, you will not see the ".sln" Other SLN files are demo widgets for how to wire in custom code/extensions

  3. Edit appsettings.json under CMSAdmin root directory (this corresponds to the CMSAdminCore project)

    • In the ConnectionStrings section, configure CarrotwareCMS to point to your SQL Server and database name. Note: The user account requires db_owner/dbo permissions as the application will automatically create necessary database artifacts.
    • In SmtpSettings, configure pickupDirectoryLocation to a valid directory on your development machine for local email testing.
  4. Right-click on CMSAdminCore and select Set as StartUp Project

  5. Right-click on CMSAdminCore and select Rebuild. The project should download all required NuGet packages and compile successfully

    Note: You may see some compilation warnings; these can generally be ignored.

  6. To deploy a sample widget, select the individual project and select Rebuild. The post-build task will copy the widget views and assemblies into the main website project.

  7. SQL Server should be running with an empty database matching the one specified in the connection string. If you are running the code a second or later time, it will auto update if there are schema changes (see dbo note above).

    • Do not share a database between the Core, MVC 5, and WebForms editions. You can update the schema if you want to upgrade and take your existing data to the newer version.
    • If you manually add the first EF migration to an existing MVC5 version of this CMS, it will automatically migrate the data. This is not done automatically to prevent accidental or unintentional upgrades
    • Password hashes will not be valid when upgrading MVC 5 (or possibly earlier MVC Core versions) to MVC Core 8, so perform a password recovery to set valid ones.

Make a backup FIRST when upgrading!

-- If restoring a database from an older SQL version (pre-2016) to a newer database platform (SQL 2016+), 
-- the compatibility level must be updated to 130 or higher for EF Core 8 support.
-- Symptom of an improper compatibility level: "SqlException: Incorrect syntax near the keyword 'WITH'."
-- Ref: https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-compatibility-level

-- Replace [CarrotCoreMVC] with your actual database name, CarrotCoreMVC is the database name found in appsettings.json
ALTER DATABASE [CarrotCoreMVC]
    SET COMPATIBILITY_LEVEL = 130; -- SQL Server 2016 or higher

-- if you plan to use an existing database from the MVC 5 version, you will need to have some entries in the migrations table
-- password hashes from MVC 5 will be invalid, perform a password recovery to set valid ones
-- Do not share the database between the Core, MVC 5, and WebForms editions.

-- to create the migrations table:

--========================
CREATE TABLE [dbo].[__EFMigrationsHistory](
    [MigrationId] [nvarchar](150) NOT NULL,
    [ProductVersion] [nvarchar](32) NOT NULL,
 CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY CLUSTERED 
(
    [MigrationId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
--========================

-- main CMS MVC 5-> MVC Core 8 - create the ef table (if needed) and execute the insert for 00000000000000_Initial
-- the password hashes will be incorrect, so perform a password reset once the DB has been upgraded
IF (NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] where [MigrationId]='00000000000000_Initial')
            AND EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[membership_User]') AND type in (N'U'))) BEGIN
    insert into [__EFMigrationsHistory]([MigrationId],[ProductVersion])
        values ('00000000000000_Initial','8.0.0')
END

--========================
-- below are manual entry migrations in case you are upgrading from MVC5 to .Net Core, only run if the table already exists

-- photo gallery widget - create the ef table (if needed) and execute the insert for 20230625212349_InitialGallery
IF (NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] where [MigrationId]='20230625212349_InitialGallery')
            AND EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tblGallery]') AND type in (N'U'))) BEGIN
    insert into [__EFMigrationsHistory]([MigrationId],[ProductVersion])
        values ('20230625212349_InitialGallery','8.0.0')
END

-- simple calendar widget - create the ef table (if needed) and execute the insert for 20230709210325_InitialCalendar
IF (NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] where [MigrationId]='20230709210325_InitialCalendar')
            AND EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tblGallery]') AND type in (N'U'))) BEGIN
    insert into [__EFMigrationsHistory]([MigrationId],[ProductVersion])
        values ('20230709210325_InitialCalendar','8.0.0')
END

-- event calendar widget - create the ef table (if needed) and execute the insert for 20230723225354_InitialEventCalendar
IF (NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] where [MigrationId]='20230723225354_InitialEventCalendar')
            AND EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tblGallery]') AND type in (N'U'))) BEGIN
    insert into [__EFMigrationsHistory]([MigrationId],[ProductVersion])
        values ('20230723225354_InitialEventCalendar','8.0.0')
END

-- faq widget - create the ef table (if needed) and execute the insert for 20240421191144_InitialFaq2
IF (NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] where [MigrationId]='20240421191144_InitialFaq2')
            AND EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[carrot_FaqCategory]') AND type in (N'U'))) BEGIN
    insert into [__EFMigrationsHistory]([MigrationId],[ProductVersion])
        values ('20240421191144_InitialFaq2','8.0.0')
END

--========================

-- to validate
select * from [__EFMigrationsHistory] where [MigrationId] like '%Initial%'
  1. SQL Server should be running with an empty database matching the one specified in the connection string. Do not share a database between the Core, MVC 5, and WebForms editions.

  2. If the database is empty or has pending database changes, the EF migrations will be automatically applied.

  3. The first time you start up the website, it will create the required artifacts in the database (tables/views/sprocs etc.)

  4. Select the run mode (e.g., IIS Express) and click the Play button (or hit F5) to launch CarrotCakeCMS

  5. When you run the website with an empty user database, you will be prompted to create the first user

  6. Once you have created a user, you can go to the login screen, enter the credentials

  7. After successfully logging in, you can create and manage your new website

Using CarrotCakeCMS (MVC Core)

  • Static Assets: All public-facing assets (images, CSS, JS) must reside within the wwwroot directory.
  • Configuration: Application settings are managed via appsettings.json.
  • Documentation: See the CarrotCakeCMS Documentation for detailed user guides.