How to reference custom module project to .NET Core MVC Web app AND .Net Framework Kentico CMS

Hendrik Clercx asked on June 23, 2023 10:57

I am doing a conversion to .NET Core for my MVC web app. I have a dedicated project that contains a custom module, setup as explained here:

Part of the conversion was also converting this separate project (which contains the custom module) to .NET Core. This makes it impossible to still reference it to the Kentico CMS project no?

The documentation says the following which is not clear:

Image Text

So how do I reference both?

As a quick solution I duplicated the project, one written in .NET core, one in .NET Framework. But that doesn't feel right...?

Correct Answer

Liam Goldfinch answered on June 23, 2023 17:22

You could make this a .NET Standard 2.0 class library, and then you can reference the project from .NET Core and .NET Framework 4.8.

We do this to share Page Type generated classes and custom module code that may be shared between both the admin and MVC applications.

Would this work for your scenario?

0 votesVote for this answer Unmark Correct answer

Recent Answers

Hendrik Clercx answered on June 23, 2023 21:03 (last edited on June 23, 2023 21:04)

Hi Liam

Yes I thought of this but I was hoping to have a more elegant solution, I guess a .net standard project will do the job then. For the record my solution was far from elegant :D.

A bit strange the documentation doesn't mention this, that's why I thought, lets ask the question here.

Anyway, thanks for helping!

0 votesVote for this answer Mark as a Correct answer

Liam Goldfinch answered on June 23, 2023 23:06

Yeah I think for now with Kentico Xperience 13 that is probably the best approach, luckily with Xperience by Kentico (the next version of Kentico) it is all .NET Core and you won't have this problem :)

By the way, with Kentico's documentation if you have any suggestions or corrections you can submit feedback via the button at the bottom of the page, see this:

Image Text

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.