Creating Sitefinity Add-ons is a great idea and feature. It allows you to bundle up parts of your Sitefinity development into a Nuget package and distrubite it. I had a feature that I was keen to export but I soon realised there was a big cavert which caused me a bit of dejection around it.
In a nutshell, you create an add-on via the Sitefinity backend. It then creates the bones of a NuGet package ready for you to 'pack' and deploy. Not that Woo-hoo just yet. But what is really cool is that it allows you to select Sitefinity modules such as News or Blogs and Dynamic Modules that you have created and export those structures and if you like their content. It is included in the Nuget package so that when it is added to the target project and run it adds the schema. How cool is that! I thought so.
I created my first project, (Snipcart Commerce), exported it, packaged it up and deployed. The package consists of a Dynamic Module, a class library project and some sample files. These were all deployed as expected. I activated the module in the target project and it all worked.
Then I thought of some changes and improvements, implemented those in my development project and exported and packaged up version 2.0.
This upgrade had changes to the Dynamic Module schema. I had changed a few fields and added some. That sounds ok. But I had also added some custom fields on my target site. This was by design, a requirement. The package deploys the minimal fields for an online product but most people will want to add other fields. The fields that one site needs are not going to be the same as another site and I didn't want to create and deploy every conceivable field that people may want.
But what is going to happen when package 2.0 is deployed. As I guessed, those custom fields would be deleted. I talked to Sitefinity and they confirmed that this scenario was not a good idea.
When it comes to these Add-ons you need to consider that these may be one time installs. Starters only. For me right now my best bet is to do a regular 'Export to zip' of the module and allow people to import that the first time. Then I can continue to enhance and improve the class library and other accompanying files in future releases.
I am guessing that this is by design for Sitefinity right now. These add-ons are meant to be get started add-ons and not meant to have upgrades. So what would I like to see in release 2.0 of the Add-on?
I think would be good is an option. If you select this option then when the Module is deployed, (and I am thinking of Dynamic Modules here) that the fields of your module are not editable in the Sitefinity backend. Just like when you look at the News module. There is a list of fields you can not change. Also when this module is deployed, it does not delete any fields. It only adds new fields and modifies its own.
I have created a Feedback ticket for this, so if you agree, go and vote it up as well as add your own thoughts about it.
Thanks for reading and feel free to comment - Darrin Robertson
Make a Comment