Setup Orchard Core in Visual Studio using Nuget

Posted by Me on February 02, 2019

This post is part of the Create an Orchard core site and deploy using Azure DevOps series.

If you are following along then you will have already created an empty .net core site, otherwise go Create an ASP.net Core Website in Visual Studio 2017

  1. Simply add the NuGet pagckage OrchardCore.Application.CMS.Targets by right clicking on the Web project and selecting Manage NuGet Packages…:

  2. Brows for packages and enter OrchardCore.Application.CMS.Targets in the search box. NOTE: you may need to check the Include prerelease option because at time of writing the beta3 was the latest package on nuget.org

  3. Select the package and click Install

NOTE: If you are looking for the latest development build then you need to add MyGet as a package source. Which is explained in Chris Payne's blog post here.

  1. Configure your site to run Orchard Core by opening the Startup.cs file and adding services.AddOrchardCms() and app.UseOrchardCore(). Like so:

     public class Startup
     {
     	// This method gets called by the runtime. Use this method to add services to the container.
     	// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
     	public void ConfigureServices(IServiceCollection services)
     	{
     		services.AddOrchardCms();
     	}
    
     	// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
     	public void Configure(IApplicationBuilder app, IHostingEnvironment env)
     	{
     		if (env.IsDevelopment())
     		{
     			app.UseDeveloperExceptionPage();
     		}
    
     		app.UseOrchardCore();
     	}
     }
     
  2. Click play:

You should see the setup page for the Orchard Core site

For this project I have chosen the Agency recipe and used Sqlite for the database, but that is up to you. Enter the rest of the details and click Finish Setup"

Boom! Orchard Core

Update: If you are using .net core 2.2 then you will need to manually add the wwwroot folder to your web project other wise you will get an exception:

Additional Resources: