Updating Custom Features

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
6/15/2012 7:01:33 PM
Gravatar
Total Posts 148

Updating Custom Features

I have created a custom feature with a resource file and feature settings config file.  

Whenever I update the control (add a new setting for example) the new settings are not shown when I visit the Settings page.  The system leaves the old settings there.  I visited the Setup page, I have updated the control with the "Update" button, cleared my cache but to no avail.  I cannot get the system to recognize the new settings. 

 

6/18/2012 6:42:05 AM
Gravatar
Total Posts 18439

Re: Updating Custom Features

When you create a feature it is best to use a feature definition file and you must use a unique guid for the featureGuid. If you installed the feature manually a feature guid was generated in the page and if you later add a feature definition you must use the same feature guid there.

When you add a new setting in the featureDefinition file the setup page will add the setting, but if the featureGuid is not correct it end up installing it as a new feature rather than updating the existing one and things get out of sync. You may want to compare the feature guid in the database mp_FeatureDefinitions table vs the one in the featureDefinition file and the one on the instance of your feature in mp_Modules.

Note that the setup page and the featuredefinition file only sets the default settings, it does not update existing instances if you change the default setting value, it only makes it so that newly created instances will get the new default value. 

Hope that helps,

Joe

6/18/2012 10:15:06 AM
Gravatar
Total Posts 148

Re: Updating Custom Features

I didn't change the original GUID. In fact, if I go to the Feature Settings page and delete the same settings I deleted in my Resource File and Feature Config File and then  manually add the new settings the feature works fine. The system is not updating the feature automatically. 

This is exactly what I did:

I created a custom feature. I created a Resource File and Feature Config File.  I ran the Setup Page and installed the feature.  I used the feature on a page and everything worked fine.

I then added and deleted some feature settings in the Resource File and Feature Config File. I ran Setup again. Any new installation of the feature still uses the old settings.  The settings that I deleted are still on the Feature Settings page and the new Feature Settings I added are not there.  I need to manually delete the settings I don't want and manually add the new settings, then any new instance I use works fine.

6/18/2012 10:33:17 AM
Gravatar
Total Posts 18439

Re: Updating Custom Features

If your feature is in a custom project, your feature definition file should also be on your project and copied by your post build event into /Setup/applications folder

When you make any changes in your code you need to build your project again so the updated files get copied again by the post build event.

The setup page is working correctly, it is used the same for all mojoPortal included features as well as all add on products. If it isn't working for you then you are not doing something correctly. You should make sure the the copy of your feature definition file under Web/applications/[yourfeaturename]/FeatureDefinitions is the correct updated version and has no mistakes or missing items. The copy that you edit should be in your own project.

You should also as I mentioned before look in the mp_Modules table, find the row for your instance of the feature that doesn't have the correct settings and make sure it has the correct feature guid. Please double check it. 

Myself I never install features manually I always use feature definition files and they always work, going back and forth between manual and feature definition installation is not a good idea.

You can study the post build events and feature definition files in mojoPortal.Features.UI and WebStore.UI to learn more.

Also if there are any mistakes in your featuredefinition file it could be throwing errors that would be logged. ie things like declaring an ISettingControl type of setting with an incorrect path to the control or an error occurs in the control itself would also cause it to fail to load in the feature settings page.

 

6/19/2012 3:13:06 PM
Gravatar
Total Posts 148

Re: Updating Custom Features

It's very strange.  I can delete all my string values except the FeatureName value from my resource file and delete all of the same in the config file and the names still appear on the settings page.  Even after building my project, visiting the setup page and updating the control. I wonder where the settings page is getting the names from if I have deleted them everywhere. They are not present in my code anywhere not in a resource file or anywhere else. I have been using custom features for almost a year now and I have never had this problem before.

6/19/2012 3:33:53 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Updating Custom Features

Once setup runs and creates the key/value pairs for a feature's settings, they are stored in the database. This thread is a little older but should have good information for you about uninstalling/reinstalling a feature.

Jamie

6/20/2012 12:17:10 PM
Gravatar
Total Posts 18439

Re: Updating Custom Features

The setup page does not delete settings that no longer exist in the feature definition file. It only installs settings (into the db) that exist in feature definition file but not in the db or updates ones that already exist.  Also it only sets the defaults used when new instances are created, it doesn't change settings on instances of a feature that already exist. When a new setting is added to the featureDefinition, the instance doesn't get its own copy of that setting until you visit the feature instance settings and save it. That is why we usually wrap a class around the feature settings so that the defaults for new settings can be used even if the instance settings have not been updated. As an example see the BlogConfiguration class which is a wrapper around the many settings for the blog. It makes it easier and cleaner to use the settings from code because the defaults are also coded as properties there. I recommend encapsulating your feature settings the same way. I also recommend think through what settings you need carefully in advance to avoid creating and then deleting them.

You must sign in to post in the forums. This thread is closed to new posts.