Brian McKeiver's Blog

.Net Core in Kentico MVC?

2020 Update for .Net Core in Kentico MVC

Check out my latest thoughts on the topic at my .Net 5 and Kentico 2020 Beta 2 blog post.



Lately I have been asked by quite a few developers, quite a few times, if it is possible to use .Net Core 2.0 with Kentico? This is especially true with developers who are going down the path of using MVC with Kentico. So I though instead of repeating the same story over and over, I would make my opinion known publicly on my blog. 

The official short answer to this question is unfortunately no. Currently with both Kentico 10 and Kentico 11 you need to still use the full ASP.NET Framework versions 4.6.x or 4.7.x. These framework versions basically set you up to also only use MVC 5 and not anything far along than that (sorry Razor Pages).


How Can You Use .Net Core Like Technology with Kentico Today

As I mention in the introduction, you simply can't use .Net Core with Kentico when you think about the traditional approach to Kentico development. There are basically two main reasons for this. First, the platform itself is mostly built with ASP.NET Webforms technology, which is simply not in .Net Core. It is basically impossible to just convert frameworks, and two, even the outstanding Kentico Integration packages for Kentico MVC development are dependent on version 4.7 of the .Net Framework.

However, there is one option to start bridging the gap between using the latest and greatest technologies that .Net has to offer inside of Kentico. And that option is to start building your class libraries and APIs targeting .Net Standard 2.0. And before you ask, no, .Net Standard 2 is not a way to reference the original ASP.Net Framework 2.0, it is something else. .Net Standard is another new option for .Net developers and it represents a collection of .Net APIs that are intended to be available on all .NET implementations. "All" in this case basically means the original .Net Framework, .Net Core, Xamarin, UWP, and others. Clear as mud right?


ASP.Net vs. .Net Core vs. .Net Standard

While a bit old, I still thought that this diagram really represents the situation well (courtesy of the .net blog)


.Net Standard and .Net Frameworks


The point is that you need to think about these frameworks as three different things. Below is how I like to think about the correct time to use each of them.

Developers should use the ASP.Net Framework when:

  • They need to work with, support, and maintain ASP.Net WebForms based technologies and web apps.
  • For Kentico developers, this specially means you will still develop your custom web parts, custom modules and custom form controls targeting .Net Framework 4.6+ in the Portal engine methodology.
  • For Kentico MVC developers to build MVC 5 sites with Kentico 9, 10, or 11.0.
  • Developing Windows Form Apps and older WPF apps.
  • Building WCF style web services.

Developers should use .Net Core when:

  • They want to build apps that work on multiple platforms. .Net Core really shines with it's cross platform abilities.
  • They want to go all in on a Microservice architecture pattern.
  • They want to use the fantastic headless CMS option Kentico Cloud.
  • They want to use the latest and greatest CLIs and editors (hint VSCode is amazing).
  • They want to increase the .NET API surface area your library can access, and you are okay with allowing only .NET Core apps to be compatible (.Net Core has about a dozen or so extra API libraries from Microsoft when compared to .Net Standard).

Developers should use .Net Standard when:

  • They want to write re-usable and portable code that could potentially run in any .Net Framework.
  • They want to start building class libraries, APIs, and NuGet packages with the future in mind
  • They want to start using newer optimized .Net APIs inside of a Kentico project and having an easier time migrating to .Net Core when the time is right.


How to use .Net Standard with Kentico

Today to use .Net Standard with Kentico (really Kentico MVC only, because in the portal engine it wouldn't make a ton of sense) you must create your new class libraries that target .Net Standard 2.0 and use a recent version of the ASP.Net Framework and a recent version of Visual Studio to make it all work. Below are your two choices for making it work.


The Minimum Requirements: You must be using at least Kentico 9.0 with ASP.Net Framework version 4.6.1, and using at least Visual Studio 2017 version 15.3 or higher.

  • In this model, when you build and run a solution that contains references to any .Net Standard 2.0 component Visual Studio helps out by automatically referencing and copying in the netstandard.dll (which is what you need) into your Kentico site's bin directory and it should just work. To verify you should see the dll in the bin folder like so:

Kentico 11 and NetStandard.dll


The Recommended Requirements: If you can, go with Kentico 11.0 using ASP.NET Framework 4.7.1, and using Visual Studio 2017 version 15.5 or higher.

  • With the recommended requirements you don't need to worry about the netstandard.dll. It is already part of the ASP.Net Framework 4.7.1. No extra files are needed at all.
  • Even though the Kentico 11.0 installer only gives you a choice of .Net 4.6 or .Net 4.7 you can updated your project's target framework to 4.7.1 right after the install it should work just fine. I have tested it.

Kentico11 .Net Framework 4.7.1



The Future

If you are following the official Kentico product roadmap there are already some references to where Kentico is going. Kentico 12.0 is going to focus on bringing Kentico MVC to newer .Net technologies like .Net Core and having a full visual MVC Page builder. I honestly cannot wait to see that in action.

To keep an eye on the transition, I recommend that you follow Michal Kadak on twitter or check out the #KenticoRaptor hashtag from time to time.





Please remember, these are just my opinions and experiences here. I don't actually work for Kentico and can't speak for them. But I do beleive that this post does answer the question quite well on if you can use .Net Core with Kentico. I am also not trying to lead you astray. I have tested each of the scenarios I did mention in this post and seen them work, but I'm not infallible. If you find other options or have simalir experiences please let me know via the comments.