Install Episerver CLI
Branding aside, the episerver cli is a set of tools that allow you perform various actions such as creating a database or setting up an admin user.
dotnet tool install EPiServer.Net.Cli --global
To confirm the cli has been installed:
dotnet tool list -g
(Use later) Update the cli:
dotnet tool update episerver.net.cli -g
Using CLI
Run the cli without any commands and you can see v1 has four commands ready to go. add-admin-user you can use but there's some additional steps you need to take in once inside the CMS to fully setup an admin user. For now I recommend following on and CMS setup will create one for you.
dotnet-episerver
Install Project Templates
The project templates we are so used to creating from Visual Studio can now be done via command line.
dotnet new -i Episerver.Templates
List the projects we can create. Do not use the Episerver projects, those are legacy. Instead use the new branded ones listed at the bottom.
dotnet new --list epi
(Use later) check for updated templates:
dotnet new update --check-only
(Use later) Apply updates:
dotnet new update
Create Alloy
Create a new folder and install Alloy:
dotnet new epi-alloy-mvc
Create a new Empty Project
If you'd prefer a empty site then:
dotnet new epi-cms-empty
Run the application
Compile and run the application. This is not specific to Optimizely, it is how you run any .NET Core and .NET 5 + application.
dotnet run
This serves your application under https://localhost:5000/. It may not open automatically in your browser so navigate to it manually.
Register a new admin user
Navigate to https://localhost:5000/util/register and fill out the form to create your first admin user of the site.
You'll notice if you attempt to navigate to this page again after registering then instead you'll be presented with a 404.
CMS Admin
To get into admin mode, navigate to the following: https://localhost:5000/episerver/cms/ . If you're doing this straight after registration then you will already be logged in.
You are now ready to develop!
Other useful dotnet commands
Clear all nuget cache locally
dotnet nuget locals all --clear
Restore nuget packagereferences directly from nuget feed
dotnet restore --no-cache --force