Making widgets portable to a different project

Hosam Abdeltawab asked on August 13, 2020 20:10

Hello,

I am using Kentico 12.0.61. I was wondering if there is a way to make widgets portable? I currently have a project with multiple widgets that I want to use in a completely new project. Can I someway export those widgets in package them in a NuGet package and use it in my other project or would I have to re-write all the widgets I need again? Thanks.

Recent Answers


Brian McKeiver answered on August 13, 2020 23:44

Yes, there is a way to make NuGet Package deployments for MVC widgets in Kentico 12. In fact you can check out how MVC widgets are distributed in the Kentico Xperience Marketplace and copy the mechanism for how to create the NuGet Packages from that documentation. You could then even have a private NuGet feed for your organization if you would like to keep the widgets private for your various project needs.

Now to be honest, it's not perfect, and you may need to adjust the location of your Views, JS, and CSS to match the project architecture, but the majority of the work should be totally reusable.

If you are looking for more specific help on the creation of the NuGet package itself, just reply here and I'm sure someone can point you in the right direction.

1 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on August 18, 2020 23:37

Using a Nuget package is indeed the best way to share, here's a template that may help you quickly create nuget packages from your widgets:

https://github.com/KenticoDevTrev/ShareableComponentBoilerplate

With this i've created widgets and published in about 30 minutes.

1 votesVote for this answer Mark as a Correct answer

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