Orchard Core on Linux Using VSCode

Developing Orchard Core CMS Applications on Linux using VS Code

YouTube Video

OrchardSkillsYouTubeThumbNailLinux

PDF Version of the Documentation

Developing-Orchard-Core-CMS-Applications-on-Linux-Using-VSCode.pdf

Orchard Core on Linux Using VS Code

Microsoft-loves-Linux

Introduction

Another option when developing Orchard Core application is to use Linux and VS Code. VS Code is a lightweight IDE (Integrated Development Environment). It’s also a cross platform IDE running on Linux, macOS, and Windows. It has all the popular features of an IDE like intellisence, debugging, built-in Git and most importantly extensions.

Install VS Code

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-005

Browse to the URL: https://code.visualstudio.com/download Click on “.deb Debian Ubuntu” button to download the package. Switch to the Downloads directory.

cd ~/Downloads

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-006

Run the command:

sudo dpkg -i code_1.41.1-1576681836_amd64.deb

Browse to Debian 10 Package Manager - Install .NET Core

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-007

Browse to the web page Debian 10 Package Manager - Install .NET Core at:

Debian 10 Package Manager - Install .NET Core

Register Microsoft key and feed

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-001

Run the commands:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/10/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list

Install the .NET Core SDK

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-002

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-003

Note: After installing the .NET SDK, it seems it’s not necessary to install the runtimes.

Run the commands:

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-3.0

Install the ASP.NET Core runtime

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-004

Run the commands

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install aspnetcore-runtime-3.0

Install the .NET Core runtime

Run the commands

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-runtime-3.0

Code Generation Templates

Orchard Core Templates uses dotnet new template configurations for creating new websites, themes and modules from the command shell. More information about dotnet new can be found at:

dotnet new template configurations

Install Orchard Core Code Generation Templates

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-008

Run the command:

dotnet new -i OrchardCore.ProjectTemplates::1.0.0-rc1-*

Set NuGet Source to Latest Dev Branch of Orchard Core

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-009

This will use the most stable release of Orchard Core. In order to use the latest dev branch of Orchard Core, the following command can be used:

dotnet new -i OrchardCore.ProjectTemplates::1.0.0-rc1-* --nuget-source https://www.myget.org/F/orchardcore-preview/api/v3/index.json

Once the .NET Core SDK has been installed, the templates can be used for creating Orchard Core web applications

Create a new Orchard Core CMS Web App

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-010

Switch to your projects folder. Mine is located at ~/Documents/GitHub

cd ~/Documents/GitHub

Run the commands:

mkdir MyOrchardCoreCMS
cd MyOrchardCoreCMS/
dotnet new occms -lo none
code .

Create a NuGet.config File

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-011

Click the plus file icon on MYORCHARDCORECMS folder to create a new file.

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-012

Paste in the contents for the NuGet.config file. NuGet.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="Orchard Core Preview Feed" value="https://www.myget.org/F/orchardcore-preview/api/v3/index.json" />
    </packageSources>
</configuration>

Create Build Configuration and Run the Orchard Core CMS Web App

Click on the Debug icon.

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-013

Click the "create a launch.json file".

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-014

Select .Net Core

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-015

Click on the green triangle to start running the application.

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-016

Application is running.

Launch Web Browser

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-017

Launch the web browser and set the URL to:

http://localhost:5000/

Congratulations Our Orchard Core Application is running on Linux. Enter the site name, Blog for the Recipe, your Default Time Zone, Sqlite for the database and then your administrator credentials.

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-018

Now browse to the dashboard at:

http://localhost:5000/admin

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-019

Login with your admin credentials.

Developing-Orchard-Core-CMS-Applications-Using-Linux-and-VSCode-020

Conclusion

With ASP.NET and Orchard Core CMS you can setup the development environment and create an application in minutes on Linux, macOS, or Windows machine using VS Code. Best of all it’s all free.

GitHub

The complete source code is located here.

CMS
VSCode GetStarted Linux