Monday, 09 April, 2018

Umbraco Basics – NuGet Installation

As part of my Umbraco Basics series I explain how to install Umbraco using NuGet.

Overview

When you first start developing with Umbraco even the little things can seem strange and confusing. Back in January 2017 I explained how to install Umbraco using a pre-compiled, downloadable, zipped installation file-set. In this new article I explain an alternative method: using the Umbraco NuGet package.

For this post I’ll be using Visual Studio 2017 to create and an ASP.NET MVC project with Umbraco 7.10.1 on a Windows 10 machine with IIS Express. I assume you’ve never installed Umbraco before and have limited knowledge of the Content Management System (CMS). I don’t explain how to use Umbraco, but if you'd like more information on using Umbraco I recommend watching Umbraco-TV.

Related posts

You may also be interested in reading these posts.

Prerequisites

  • Microsoft Visual Studio 2015 or higher; the free Community Edition is fine. I used 2017 for this post.
  • IIS 7+;:The version of IIS Express which ships with Visual Studio 2015 is fine.
  • SQL Server 2014+: SQL CE (Compact Edition) will work too but not is recommended; Azure SQLServer is fine too but not explained here.

Optional Extra Tools

Creating the Web Project

The first things you have to do is create a working Asp.NET MVC website Project. Here are the steps.

1) Launch Visual Studio.

enter image description here

2) Select File > New > Project. Select Asp.NET Web Application (.NET Framework); and enter your project name, folder location.

Side note: for this post I used .NET Framework 4.6.1.

enter image description here

3) Click OK and create the project.

4) Optionally build and run the project.

Installing Umbraco Using NuGet

Now you have a working ASP.NET MVC Website. It's time to add Umbraco to it.

1) Open the Package Manager Console ( View > Other Windows > Package Manager Console ).

Package Manager Window

2) Type: Install-Package UmbracoCms

3) When prompted whether to overwrite the Global.asax, enter Y, hit return.

Prompt

4) Umbraco is now installed. Build the project (F7) and run it (F5).

Side note: If you view the markup for the overwritten Global.asax it will now inherit from Umbraco.Web.UmbracoApplication to hook up to the Umbraco core. The code and routing defined in Global.asax.cs derived from System.Web.HttpApplication will not be run. You can test this by setting a break point on the Application_Start function. You may wish to clean up and remove this unused code.

Create the Umbraco Database

After, or maybe even while, installing Umbraco you'll need to set-up the database. Umbraco offers four different database engines to choose from:

  • SQL CE : SQL CE (Compact Edition) is easy to set-up and fine for testing but not really suitable for a true website. If installing SQL Server seems like overkill you can always install using SQL CE and optionally upgrade to an SQL Server later on - just amend the connection string in web.config to point to the new server and database.

  • SQL Server (recommended): SQL Express and Developer editions are freely available on Microsoft's website and fairly painless to install.

  • SQL Azure: SQL Azure is a fine choice but requires an Azure account with an SQL Server and database set-up for Umbraco. This isn't something I'm going to cover in this post.

  • MySQL ( not recommended): MySQL isn’t recommended and probably won’t work without considerable tinkering. If you're looking at a Linux set-up then maybe consider Microsoft's SQL Server for Linux.

Assuming you decide to go with SQL Server you'll need to:

1) Create a database on the server.

  • Create a new database using Visual Studio by selecting View > SQL Server Object Explorer, then select Add SQL Server to connect to your server and manage it [you may need to supply some credentials for remote servers); right click on databases to add new databases.
  • Alternatively, if like me you don't like Visual Studio's SQL Server tools, you can use Microsoft's SQL Server Management Studio to create the database instead (as shown below):

MSMS

2) Provide Umbraco with the Server name, database name and access credentials. I use Windows authentication on development machines. You'll see how you do this in the next section.

Configure Umbraco

Once you've built and run Umbraco you'll be presented with a configuration screen. Provided you've set-up the database in the last step you're ready to go and fill in the form.

Umbraco config form

Fill in your username, email and password and then Click Customise.

Umbraco customise form

Select Microsoft SQL Server and enter your server's IP address or URL, and the name of Umbraco Database you created earlier.

If working on development machine with SQL Server select Integration Authentication; If working with a remote SQL Servers provide the SQL Login and Password Credentials.

Click Continue.

When asked. create a machine key (click Continue). This important for cloud based environments.

Optionally install the start website (recommended for newbies). Umbraco Starter Kit

Side note: The connection string for the database settings maybe changedlater in the web.config file.

Once the above steps are completed and Umbraco connects to the SQL Server Database it will create all the required database tables on your new database and display the Umbraco backoffice. The backoffice is Umbraco's admin portal where you can create and modify the website. The front end of your website is accessible by removing the /umbraco suffix to the URL.

Summary

Congratulations, you should now have a working Umbraco installation. The installation process takes you through to the backoffice, uou can view the website, not the admin portal, by removing the /umbraco segment from the browser's URL.

The CMS web application runs and works like any other ASP.NET application, you can debug it, deploy it, just as you would any other ASP.NET application.

Want to Thank Me?

Did you like this article? Was it helpful? Why not buy me a coffee on Paypal? Buy me a coffee?