UPDATE: The process for creating a new CMS project is now very different from described below. Check the latest documentation here.
This is my experience on how to get started with the preview version of Optimizely CMS. Expect this blog post to be outdated fairly soon…
Finally I took the time to take a look at the brand new Optimizely CMS, the .Net 5 version of former Episerver CMS. It seems to be pretty easy to get started according to this blog post by Mark Hall. It’s just a few commands and your ready to go. Nice!
I tried this on a windows machine, .Net 5 SDK was already installed and Visual Studio was up to date. I ran the commands in Powershell 7 (in Windows terminal).
Installing the tools worked fine. And creating the site using
dotnet new epicmsempty --name ProjectName
also worked as expected. But I ran into problem when creating the database
dotnet-episerver create-cms-database ProjectName.csproj -S . -E
An SQL server could not be found. I quickly realized that the “-S .” means that the command tries to use an SQL server on my local machine. I don’t have the full SQL Server installed locally, I mainly use LocalDb when I have the need for a local database. I changed the command to (note that it needs to be inside “”):
dotnet-episerver create-cms-database ProjectName.csproj -S "(LocalDb)\MSSQLLocalDB" -E
The command now tries to create a database in my LocalDb, but it fails because it doesn’t have the permission to create the database file in the C:\Users directory. I’d prefer that it created the database file in the project directory, but to be able to continue I gave “Everyone” full control to the C:\Users directory. Now the command ran without failure, and I could see the database file being created.
Next step is to compile and run the site with
Yeah that didn’t work… There is a hint in Mark´s blog post: If the run command fails with missing assembly add beta feed package source to nuget.config on the root of the project folder and rerun.
Ok. There is no nuget.config file in the project root, and what should the content of that file be?
Fortunately I found it in the .Net 5 Foundation sample site (https://github.com/episerver/Foundation/blob/net5/Nuget.config), and now the solution could compile and run.
The site is now accessible on http://localhost:8000/ (and https://localhost:8001/), and responds with a 404. That is expected since it is a completely empty site. Now, let´s see that new shiny backend by going to http://localhost:8000/episerver . Still a 404 response… what? Ok, trying with /episerver/cms. Yeah now the familiar login screen is showing up! Now I can just login with… hmm… no default admin user is created, and it doesn’t seem to work using a local administrator account as it does on previous versions. So now I have a CMS but there is no way to log in…
By adding this file to my solution, and adding this line in Startup.cs:
an administrator user (firstname.lastname@example.org/Episerver123!) is created and signed in as soon as I go to /episerver/cms.
Now I can finally take a look at the new Optimizely CMS! 🎉
If you are curious what it looks like you can take a look at Scott Reed´s blog post.
Setting up the preview version of the Foundation sample site
Now that I have an empty solution up and running, I also wanted to take one of the sample sites for a test drive. Mark´s blog post links to the repository for the preview version of the .Net 5 Foundation sample site. The instructions for setting that up is: Right-click on the batch file called setup.cmd and select Run as administrator.
This will set up the site and database in one go. Unfortunately I couldn’t get that script to work with LocalDb, so I set up an Azure SQL database and tried running the setup script again. After a while the script failed showing: …\build.ps1 cannot be loaded. The file C:\Projects\Foundation-net5\build\build.ps1 is not digitally signed.
Today is not my lucky day…
I know this is a preview version, but I expected it to be a bit more polished now that it is a public preview. For many years Episerver CMS has, in my opinion, been an extremely developer friendly CMS. A very simple and hassle-free experience, even for developers with no Episerver experience.
But now you are competing with all the different SaaS CMSs out there. It needs to be super simple to get started, the documentation needs to be updated and relevant, and instructions need to be tested. Even for preview versions.
But I’m really exited to get started with this new .Net5 version!
4 thoughts on “Getting started with Optimizely CMS preview”
Thanks for the feedback. I will make sure to update the blog post about what the parameters mean. Obviously local database is not an option for non windows users so it is not something we spent much time on. I will also make sure to update the blog post to set the correct PowerShell permission before running setup on foundation.
As for the admin user, we are still debating the best way to seed a user. The identity schema is installed as part of initialization, so we need to wait until after the site runs to add the account. I would like to add an option to cli tool to create a user. Do you think this would be a good option.
I think I prefer using the CLI over having some code that should only be used one time. That dead code might never be removed, and could potentially be a security issue.
I experienced the same powershell issue today and found root cause for my situation. I posted the solution and cause on GitHub, I hope it could help