<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">Blog posts by Julian</title><link href="http://world.optimizely.com" /><updated>2025-05-27T22:16:32.0000000Z</updated><id>https://world.optimizely.com/blogs/julian/</id> <generator uri="http://world.optimizely.com" version="2.0">Optimizely World</generator> <entry><title>Getting Started with CMS 12 and Commerce 14: A Beginner’s Guide to Creating CMS and Commerce Projects</title><link href="https://world.optimizely.com/blogs/julian/dates/2025/4/creating-an-optimizely-commerce-14-project-2025/" /><id>&lt;p&gt;Getting started with Optimizely can sometimes be confusing. I realized that a clear, step-by-step guide to creating a solution with separate CMS 12 and Commerce 14 projects is hard to find. So, here&amp;rsquo;s a detailed walkthrough to help you implement it smoothly.&lt;/p&gt;
&lt;p&gt;Get your Visual Studio 2022, SQL Server Management Studio, and a PowerShell terminal ready and let&amp;rsquo;s get started!&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;1. Install all the Optimizely necessary tools first&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;First of all, as usual, you need to install all the required tools as described &lt;a href=&quot;https://docs.developers.optimizely.com/content-management-system/docs/installing-optimizely-net-5#install-a-cms-sample-site-with-alloy-templates&quot;&gt;here&lt;/a&gt; and &lt;a title=&quot;here&quot; href=&quot;https://docs.developers.optimizely.com/content-management-system/docs/installing-add-ons#before-you-install-apps-from-visual-studio&quot;&gt;here&lt;/a&gt; , if you are all set up ignore this step&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install templates =&amp;gt; &lt;code&gt;dotnet new -i EPiServer.Templates&lt;/code&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Install CLI =&amp;gt;&amp;nbsp; &lt;code&gt;dotnet tool install EPiServer.Net.Cli --global --add-source&amp;nbsp;&lt;a href=&quot;https://nuget.optimizely.com/feed/packages.svc&quot;&gt;https://nuget.optimizely.com/feed/packages.svc&lt;/a&gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add Nuget source &quot;https://api.nuget.optimizely.com/v3/index.json&quot; in Visual Studio &amp;gt; Tools &amp;gt; Options &amp;gt; NuGet Package Manager &amp;gt; Package Sources. Note: For some reason, Optimizely&amp;rsquo;s documentation doesn&amp;rsquo;t clearly state that this step is necessary (at least at the time of writing). However, if you skip it, you won&amp;rsquo;t be able to manage NuGet packages correctly. The only place that mentions it still refers to the old source &quot;https://nuget.episerver.com/feed/packages.svc/&quot;, both sources work&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/link/eb27adc7f42f46ada124e2c23c6ff1ca.aspx&quot; width=&quot;518&quot; height=&quot;359&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;2. Create the Solution and Projects&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Navigate to the folder where you want to create the entire project. From there, we&amp;rsquo;ll run the necessary commands to create the solution, a project for Commerce, and another for the CMS.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create the solution =&amp;gt; &lt;code&gt;dotnet new sln -n MyEcommerce -o MyEcommerce&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Move into the created folder =&amp;gt; &lt;code&gt;cd MyEcommerce&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Create the CMS project =&amp;gt;&amp;nbsp;&lt;code&gt;dotnet new epi-cms-empty -n MyEcommerce.Web -o MyEcommerce.Web&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Create the commerce project =&amp;gt; &lt;code&gt;dotnet new razorclasslib -n MyEcommerce.Commerce -o MyEcommerce.Commerce&lt;/code&gt;, there is a template for empty commerce project but sometimes the commerce project must be installed after the CMS project so I want to show this way as well&lt;/li&gt;
&lt;li&gt;Add the CMS project to the solution =&amp;gt;&amp;nbsp;&lt;code&gt;dotnet sln add .\MyEcommerce.Web\&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add the Commerce project to the solution =&amp;gt; &lt;code&gt;dotnet sln add .\MyEcommerce.Commerce\&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;-n&lt;/strong&gt; Project name&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;-o&lt;/strong&gt; Output directory&lt;/p&gt;
&lt;p&gt;Now you can open the solution in visual studio 2022, right click on MyEcommerce.Web and set it as startup project&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/518149e8eb05478e828704a17dea4253.aspx&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Then right click on the solution and select &quot;Manage Nuget packages for Solution&quot; and ensure Package source is &quot;All&quot; in the top right corner&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/8a7ab254758e402b9abf7a6e731700d3.aspx&quot; width=&quot;247&quot; height=&quot;70&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Check that both project &quot;MyEcommerce.Commerce&quot; have the same .Net version as &quot;MyEcommerce.Web&quot;, For example, in the image bellow I have to change the target framework from net9.0 to net8.0 and update Microsoft.AspNetCore.Components.Web package&amp;nbsp; from 9.0.3 to 8.0.16&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/cc242e3691d2404aaad5a14ef1cbaeee.aspx&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Right click on MyEcommerce.Web.csproj / Dependencies then select &quot;Add project reference&quot; and choose &quot;MyEcommerce.Commerce&quot; to add it as a reference&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;3. Configure the projects to use Optimizely Commerce&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;First, Check if&amp;nbsp; &quot;EPiServer.CMS&quot; is installed in &quot;MyEcommerce.Web&quot; using Nuget Manager, if it&#39;s not the latest version then update it. Then search &quot;EPiServer.Commerce&quot; in the nuget package manager and install the latest version in both projects&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/2c0be042d5e14e989cffd010bc3f0565.aspx&quot; width=&quot;661&quot; height=&quot;256&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Go to &quot;MyEcommerce.Web&quot; project and open Startup.cs, replace the call to &quot;.AddCms()&quot; with &quot;.AddCommerce()&quot; (this method internally implements AddCms())&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/9defe486056b40cbaeee2d3598ffa690.aspx&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Update appsettings.Development.json to include commerce virtual roles in&amp;nbsp; MappedRoles:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code&gt;&quot;MappedRoles&quot;: {
  &quot;Items&quot;: {

    &quot;CmsEditors&quot;: {
      &quot;MappedRoles&quot;: [ &quot;WebEditors&quot;, &quot;WebAdmins&quot; ]
    },
    &quot;CmsAdmins&quot;: {
      &quot;MappedRoles&quot;: [ &quot;WebAdmins&quot; ]
    },
    &quot;Administrators&quot;: {
      &quot;MappedRoles&quot;: [ &quot;WebAdmins&quot;, &quot;Admins&quot; ]

    },
    &quot;CommerceAdmins&quot;: {
      &quot;MappedRoles&quot;: [ &quot;WebAdmins&quot; ]
    },
    &quot;CatalogManagers&quot;: {
      &quot;MappedRoles&quot;: [ &quot;WebAdmins&quot; ]
    },
    &quot;CustomerServiceRepresentatives&quot;: {
      &quot;MappedRoles&quot;: [ &quot;WebAdmins&quot; ]
    },
    &quot;MarketingManagers&quot;: {
      &quot;MappedRoles&quot;: [ &quot;WebAdmins&quot; ]
    },
    &quot;OrderManagers&quot;: {
      &quot;MappedRoles&quot;: [ &quot;WebAdmins&quot; ]
    },
    &quot;ReportManagers&quot;: {
      &quot;MappedRoles&quot;: [ &quot;WebAdmins&quot; ]
    }
  }
}
    &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;4. Configure the databases&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;When Optimizely creates a project using the CLI or the graphical interface, it creates the database in MyEcommerce.Web/App_Data folder as .mdf files, but that&#39;s not going to work properly when creating a project for development, so we will switch that to use Sql Server&lt;/p&gt;
&lt;p&gt;Go to MyEcommerce.Web/App_Data folder and delete any files created there, then open appsettings.Development.json and remove the ConnectionStrings section&lt;/p&gt;
&lt;p&gt;Open powershell and navigate to the MyEcommerce.Web project &lt;code&gt;cd .\MyEcommerce.Web\&lt;/code&gt; Now create the cms database using the CLI, so first copy the server name from Sql Server Management Studio and replace it in next command, this will create the database and the connection string in appsettings.json&lt;/p&gt;
&lt;p&gt;&lt;code&gt;dotnet-episerver create-cms-database MyEcommerce.Web.csproj -S &amp;lt;ReplaceWithServer&amp;gt; -E -dn MyEcommerceCMS&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;-S&lt;/strong&gt; Server name&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;-E&lt;/strong&gt; Create the connection string as integrated security&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;-dn&lt;/strong&gt; Database name&lt;/p&gt;
&lt;p&gt;Now we can run the project and it will ask you to create the Admin user, if for some reason it doesn&#39;t ask you to create it then use this command to create the admin user replacing the username, email and password&lt;/p&gt;
&lt;p&gt;&lt;code&gt;dotnet-episerver add-admin-user &amp;nbsp;MyEcommerce.Web.csproj -u MyUSer -e myuser@email.com -p MyUser123* -c EPiServerDB&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;-u&lt;/strong&gt; User&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;-e&lt;/strong&gt; Email&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;-p&lt;/strong&gt; password&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;-c&lt;/strong&gt; Connection string&lt;/p&gt;
&lt;p&gt;Test that you can now run the project and login in the backoffice in &lt;a href=&quot;https://localhost:5000/episerver/cms&quot;&gt;https://localhost:5000/episerver/cms&lt;/a&gt; or whaterver is your localhost&lt;/p&gt;
&lt;p&gt;Now let&#39;s create commerce database&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp;dotnet-episerver create-commerce-database MyEcommerce.Web.csproj -S &amp;lt;ReplaceWithServer&amp;gt; -E -dn MyEcommerceCommerce&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;5. Add Cms Content types&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Here I will add only the basic Page and block content types, note that several content types are missing here, add each one of them in a class on its own in MyEcommerce.Web &amp;gt; Models&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;    [ContentType(
        DisplayName = &quot;Block Base&quot;,
        GUID = &quot;{E81F6E18-B49D-472D-9504-6FBE4DF8C631}&quot;
        )]
    public class BlockBase: BlockData
    {
    }

[ContentType(
    DisplayName = &quot;Page Base&quot;,
    GUID = &quot;{8C654336-F62A-46A4-9E62-F7456DD4D32E}&quot;
    )]
public class PageBase: PageData
{
    [Display(
        Name = &quot;Heading&quot;,
        Description = &quot;The main heading of the page.&quot;
        )]
    public virtual string Heading { get; set; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;6. Add basic Commerce Content Types&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Add these classes in MyEcommerce.Commerce &amp;gt; Models, each in its own class file, note that I have included only one property per class as an example, you should customize it as per your specific requirements&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;CatalogContentType(
    DisplayName = &quot;Bundle Base&quot;,
    GUID = &quot;{CCF26036-A7EF-40F2-8E69-AFB57BE00902}&quot;
    )]
public class BundleBase: BundleContent
{
    [Display(
        Name = &quot;Bundle description&quot;
        )]
    [UIHint(UIHint.Textarea)]
    public virtual string Description { get; set; }
}

[CatalogContentType(
    DisplayName = &quot;Catalog Base&quot;,
    GUID = &quot;{31B74E5C-7B0C-4538-A311-B30325AF27B2}&quot;
    )]
public class CatalogBase: CatalogContent
{
    [Display(
        Name = &quot;Catalog Description&quot;
        )]
    [UIHint(UIHint.Textarea)]
    public virtual string Description { get; set; }
}

[CatalogContentType(
    DisplayName = &quot;Category Base&quot;,
    GUID = &quot;{C310EC9C-F987-48ED-931F-285229743089}&quot;
    )]
public class CategoryBase: NodeContent
{
    [Display(
        Name = &quot;Category description&quot;
        )]
    [UIHint(UIHint.Textarea)]
    public virtual string Description { get; set; }
}

[CatalogContentType(
    DisplayName = &quot;Package Base&quot;,
    GUID = &quot;{8CFE8AAC-F359-4B8C-8D9E-98BCA64F166D}&quot;
    )]
public class PackageBase: PackageContent
{
    [Display(
        Name = &quot;Package description&quot;
        )]
    [UIHint(UIHint.Textarea)]
    public virtual string Description { get; set; }
}

[CatalogContentType(
    DisplayName = &quot;Product Base&quot;,
    GUID = &quot;{085AFC91-E49A-42E8-A146-4E8F7FBBD43A}&quot;
    )]
public class ProductBase: ProductContent
{
    [Display(
        Name = &quot;Product description&quot;
        )]
    [UIHint(UIHint.Textarea)]
    public virtual string Description { get; set; }
}

[CatalogContentType(
    DisplayName = &quot;Variant Base&quot;,
    GUID = &quot;{BEB277AE-D586-4CC1-ACCF-0A47855FCFC6}&quot;
    )]
public class VariantBase: VariationContent
{
    [Display(
        Name = &quot;Variant description&quot;
        )]
    [UIHint(UIHint.Textarea)]
    public virtual string Description { get; set; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;7. Do the Migration&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;If you navigate now to the Commerce edit mode at &lt;a href=&quot;https://localhost:5000/EPiServer/Commerce/catalog&quot;&gt;https://localhost:5000/EPiServer/Commerce/catalog&lt;/a&gt; you may see this error:&lt;/p&gt;
&lt;p&gt;&quot;Failed loading content with the url/uri: epi.cms.contentdata:///-1073741823__CatalogContent&quot;&lt;/p&gt;
&lt;p&gt;This happens because migration step which creates the catalog root is still missing&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;img-thumbnail clickable zoomable&quot; title=&quot;Click image to zoom&quot; src=&quot;/link/e78877ee9a1a42cd9374522cb37b3ded.aspx&quot; width=&quot;323&quot; height=&quot;151&quot; /&gt;&lt;/p&gt;
&lt;p&gt;It&#39;s possible that when you started the project you were redirected to a url like&amp;nbsp;&lt;a href=&quot;https://localhost:5000/EPiServer/Commerce/EPiServer/Commerce/Migrate?autoMigrate=true&quot;&gt;https://localhost:5000/EPiServer/Commerce/EPiServer/Commerce/Migrate?autoMigrate=true&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;However, for some reason Optimizely is redirecting to the wrong url, so if you take a look in detail you will see that EPiServer/Commerce is twice, to fix this change the url to &lt;a href=&quot;https://localhost:5000/EPiServer/Commerce/Migrate?autoMigrate=true&quot;&gt;https://localhost:5000/EPiServer/Commerce/Migrate?autoMigrate=true&lt;/a&gt; , you should then see this migration page:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/e574d8b4d62c4014b7a5ee62da0a7e25.aspx&quot; width=&quot;741&quot; height=&quot;280&quot; /&gt;&lt;/p&gt;
&lt;p&gt;If you see migration completed then this step is finished&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;8. Create Commerce content&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;And voil&amp;agrave;! The setup is complete, you can go now to edit mode at &lt;a href=&quot;https://localhost:5000/EPiServer/Commerce/catalog&quot;&gt;https://localhost:5000/EPiServer/Commerce/catalog&lt;/a&gt; to Create new Catalogs, inside each catalog you can create Products with variants, bundles, packages, categories&lt;/p&gt;
&lt;p&gt;Now you a have a project to handle CMS &quot;MyEcommerce.Web&quot; and another to handle Commerce &quot;MyEcommerce.Commerce&quot; both in the same solution.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/69727d5c6e8f46968ac86c0d0dcea406.aspx&quot; width=&quot;816&quot; height=&quot;405&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</id><updated>2025-05-27T22:16:32.0000000Z</updated><summary type="html">Blog post</summary></entry></feed>